registerCodec method

void registerCodec(
  1. RdfCodec<G> codec
)

Register a new codec with the registry

This will make the codec available for decoding and encoding when requested by any of its supported MIME types. The codec will also be considered during auto-detection of unknown content.

The codec parameter is the codec implementation to register.

Implementation

void registerCodec(RdfCodec<G> codec) {
  _logger.fine('Registering rdf codec: ${codec.primaryMimeType} for ${this}');
  _codecs.add(codec);

  for (final mimeType in codec.supportedMimeTypes) {
    final normalized = _normalizeMimeType(mimeType);
    _codecsByMimeType[normalized] = codec;
  }
}