datasetCodec method
- String? contentType,
- RdfGraphEncoderOptions? encoderOptions,
- RdfGraphDecoderOptions? decoderOptions,
Get a dataset codec for a specific content type
Returns a dataset codec that can handle the specified content type. If no content type is specified, returns the default dataset codec.
The contentType
parameter is an optional MIME type to specify the format.
If not specified, then the encoding will be with the default dataset codec and
the decoding codec will be automatically detected.
The encoderOptions
parameter allows for format-specific encoder options.
The decoderOptions
parameter allows for format-specific decoder options.
Returns an RdfCodec that can handle the specified dataset content type.
Throws CodecNotSupportedException if the requested format is not supported.
Implementation
RdfCodec<RdfDataset> datasetCodec({
String? contentType,
RdfGraphEncoderOptions? encoderOptions,
RdfGraphDecoderOptions? decoderOptions,
}) {
final codec = _datasetRegistry.getCodec(contentType);
if (encoderOptions != null || decoderOptions != null) {
return codec.withOptions(
encoder: encoderOptions,
decoder: decoderOptions,
);
}
return codec;
}