getArrayDecoder
Call Signature
getArrayDecoder<
TTo
>(item
,config
):FixedSizeDecoder
<TTo
[],0
>
Returns a decoder for arrays of values.
This decoder deserializes arrays by decoding each element using the provided item decoder.
By default, a u32
size prefix is expected to indicate the number of items in the array.
The size
option can be used to modify this behaviour.
For more details, see getArrayCodec.
Type Parameters
Type Parameter | Description |
---|---|
TTo | The type of the decoded elements in the array. |
Parameters
Parameter | Type | Description |
---|---|---|
item | Decoder <TTo > | The decoder for each item in the array. |
config | ArrayCodecConfig <NumberDecoder > & object | Optional configuration for the size decoding strategy. |
Returns
FixedSizeDecoder
<TTo
[], 0
>
A VariableSizeDecoder<TTo[]>
for decoding arrays.
Example
Decoding an array of u8
numbers.
See
Call Signature
getArrayDecoder<
TTo
>(item
,config
):FixedSizeDecoder
<TTo
[]>
Returns a decoder for arrays of values.
This decoder deserializes arrays by decoding each element using the provided item decoder.
By default, a u32
size prefix is expected to indicate the number of items in the array.
The size
option can be used to modify this behaviour.
For more details, see getArrayCodec.
Type Parameters
Type Parameter | Description |
---|---|
TTo | The type of the decoded elements in the array. |
Parameters
Parameter | Type | Description |
---|---|---|
item | FixedSizeDecoder <TTo > | The decoder for each item in the array. |
config | ArrayCodecConfig <NumberDecoder > & object | Optional configuration for the size decoding strategy. |
Returns
FixedSizeDecoder
<TTo
[]>
A VariableSizeDecoder<TTo[]>
for decoding arrays.
Example
Decoding an array of u8
numbers.
See
Call Signature
getArrayDecoder<
TTo
>(item
,config?
):VariableSizeDecoder
<TTo
[]>
Returns a decoder for arrays of values.
This decoder deserializes arrays by decoding each element using the provided item decoder.
By default, a u32
size prefix is expected to indicate the number of items in the array.
The size
option can be used to modify this behaviour.
For more details, see getArrayCodec.
Type Parameters
Type Parameter | Description |
---|---|
TTo | The type of the decoded elements in the array. |
Parameters
Parameter | Type | Description |
---|---|---|
item | Decoder <TTo > | The decoder for each item in the array. |
config? | ArrayCodecConfig <NumberDecoder > | Optional configuration for the size decoding strategy. |
Returns
VariableSizeDecoder
<TTo
[]>
A VariableSizeDecoder<TTo[]>
for decoding arrays.
Example
Decoding an array of u8
numbers.