withOptions method

  1. @override
NTriplesCodec withOptions({
  1. RdfGraphEncoderOptions? encoder,
  2. RdfGraphDecoderOptions? decoder,
})
override

Creates a new codec instance with the specified options

This method returns a new instance of the codec configured with the provided encoder and decoder options. The original codec instance remains unchanged.

The encoder parameter contains optional encoder options to customize encoding behavior. The decoder parameter contains optional decoder options to customize decoding behavior.

Returns a new RdfGraphCodec instance with the specified options applied.

This follows the immutable configuration pattern, allowing for clean method chaining and configuration without side effects.

Implementation

@override
NTriplesCodec withOptions({
  RdfGraphEncoderOptions? encoder,
  RdfGraphDecoderOptions? decoder,
}) {
  return NTriplesCodec(
    encoderOptions: NTriplesEncoderOptions.from(encoder ?? _encoderOptions),
    decoderOptions: NTriplesDecoderOptions.from(decoder ?? _decoderOptions),
  );
}