getNullableDecoder
Call Signature
getNullableDecoder<
TTo
,TSize
>(item
,config
):FixedSizeDecoder
<null
|TTo
,TSize
>
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
u8
prefix is used (0 =null
, 1 = present). This can be customized or disabled. - If
noneValue: 'zeroes'
is set,null
values are identified by zeroes. - If
noneValue
is a byte array,null
values 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
<null
| TTo
, TSize
>
A FixedSizeDecoder
or VariableSizeDecoder
for decoding nullable values.
Example
Decoding an optional number.
See
Call Signature
getNullableDecoder<
TTo
>(item
,config
):FixedSizeDecoder
<null
|TTo
>
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
u8
prefix is used (0 =null
, 1 = present). This can be customized or disabled. - If
noneValue: 'zeroes'
is set,null
values are identified by zeroes. - If
noneValue
is a byte array,null
values 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
<null
| TTo
>
A FixedSizeDecoder
or VariableSizeDecoder
for decoding nullable values.
Example
Decoding an optional number.
See
Call Signature
getNullableDecoder<
TTo
>(item
,config
):VariableSizeDecoder
<null
|TTo
>
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
u8
prefix is used (0 =null
, 1 = present). This can be customized or disabled. - If
noneValue: 'zeroes'
is set,null
values are identified by zeroes. - If
noneValue
is a byte array,null
values 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
<null
| TTo
>
A FixedSizeDecoder
or VariableSizeDecoder
for decoding nullable values.
Example
Decoding an optional number.
See
Call Signature
getNullableDecoder<
TTo
>(item
,config?
):VariableSizeDecoder
<null
|TTo
>
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
u8
prefix is used (0 =null
, 1 = present). This can be customized or disabled. - If
noneValue: 'zeroes'
is set,null
values are identified by zeroes. - If
noneValue
is a byte array,null
values 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
<null
| TTo
>
A FixedSizeDecoder
or VariableSizeDecoder
for decoding nullable values.
Example
Decoding an optional number.