getNullableDecoder
Call Signature
Returns a decoder for optional values, allowing null values to be recognized.
This decoder deserializes an optional value using a configurable approach:
- By default, a
u8prefix is used (0 =null, 1 = present). This can be customized or disabled. - If
noneValue: 'zeroes'is set,nullvalues are identified by zeroes. - If
noneValueis a byte array,nullvalues match the provided constant.
For more details, see getNullableCodec.
Type Parameters
| Type Parameter | Description |
|---|---|
TTo | The type of the main value being decoded. |
TSize extends number | - |
Parameters
| Parameter | Type | Description |
|---|---|---|
item | FixedSizeDecoder<TTo, TSize> | The decoder for the value that may be present. |
config | NullableCodecConfig<NumberDecoder> & object | Configuration options for decoding optional values. |
Returns
FixedSizeDecoder<TTo | null, TSize>
A FixedSizeDecoder or VariableSizeDecoder for decoding nullable values.
Example
Decoding an optional number.
See
Call Signature
Returns a decoder for optional values, allowing null values to be recognized.
This decoder deserializes an optional value using a configurable approach:
- By default, a
u8prefix is used (0 =null, 1 = present). This can be customized or disabled. - If
noneValue: 'zeroes'is set,nullvalues are identified by zeroes. - If
noneValueis a byte array,nullvalues match the provided constant.
For more details, see getNullableCodec.
Type Parameters
| Type Parameter | Description |
|---|---|
TTo | The type of the main value being decoded. |
Parameters
| Parameter | Type | Description |
|---|---|---|
item | FixedSizeDecoder<TTo> | The decoder for the value that may be present. |
config | NullableCodecConfig<FixedSizeNumberDecoder> & object | Configuration options for decoding optional values. |
Returns
FixedSizeDecoder<TTo | null>
A FixedSizeDecoder or VariableSizeDecoder for decoding nullable values.
Example
Decoding an optional number.
See
Call Signature
Returns a decoder for optional values, allowing null values to be recognized.
This decoder deserializes an optional value using a configurable approach:
- By default, a
u8prefix is used (0 =null, 1 = present). This can be customized or disabled. - If
noneValue: 'zeroes'is set,nullvalues are identified by zeroes. - If
noneValueis a byte array,nullvalues match the provided constant.
For more details, see getNullableCodec.
Type Parameters
| Type Parameter | Description |
|---|---|
TTo | The type of the main value being decoded. |
Parameters
| Parameter | Type | Description |
|---|---|---|
item | FixedSizeDecoder<TTo> | The decoder for the value that may be present. |
config | NullableCodecConfig<NumberDecoder> & object | Configuration options for decoding optional values. |
Returns
VariableSizeDecoder<TTo | null>
A FixedSizeDecoder or VariableSizeDecoder for decoding nullable values.
Example
Decoding an optional number.
See
Call Signature
Returns a decoder for optional values, allowing null values to be recognized.
This decoder deserializes an optional value using a configurable approach:
- By default, a
u8prefix is used (0 =null, 1 = present). This can be customized or disabled. - If
noneValue: 'zeroes'is set,nullvalues are identified by zeroes. - If
noneValueis a byte array,nullvalues match the provided constant.
For more details, see getNullableCodec.
Type Parameters
| Type Parameter | Description |
|---|---|
TTo | The type of the main value being decoded. |
Parameters
| Parameter | Type | Description |
|---|---|---|
item | Decoder<TTo> | The decoder for the value that may be present. |
config? | NullableCodecConfig<NumberDecoder> & object | Configuration options for decoding optional values. |
Returns
VariableSizeDecoder<TTo | null>
A FixedSizeDecoder or VariableSizeDecoder for decoding nullable values.
Example
Decoding an optional number.