getHiddenSuffixCodec
Call Signature
getHiddenSuffixCodec<
TFrom
,TTo
>(codec
,suffixedCodecs
):FixedSizeCodec
<TFrom
,TTo
>
Returns a codec that encodes and decodes values with a hidden suffix.
- Encoding: Appends hidden data after encoding the main value.
- Decoding: Skips the hidden suffix after decoding the main value.
This is useful for any implicit metadata that should be present in binary formats but omitted from the API.
Type Parameters
Type Parameter | Description |
---|---|
TFrom | The type of the main value being encoded. |
TTo | The type of the main value being decoded. |
Parameters
Parameter | Type | Description |
---|---|---|
codec | FixedSizeCodec <TFrom , TTo > | The codec for the main value. |
suffixedCodecs | readonly FixedSizeCodec <void >[] | A list of void codecs that produce the hidden suffix. |
Returns
FixedSizeCodec
<TFrom
, TTo
>
A FixedSizeCodec
or VariableSizeCodec
for encoding and decoding values with a hidden suffix.
Example
Encoding and decoding a value with suffixed constants.
Remarks
If all you need is padding zeroes after a value, consider using padRightCodec instead.
Separate getHiddenSuffixEncoder and getHiddenSuffixDecoder functions are available.
See
Call Signature
getHiddenSuffixCodec<
TFrom
,TTo
>(codec
,suffixedCodecs
):VariableSizeCodec
<TFrom
,TTo
>
Returns a codec that encodes and decodes values with a hidden suffix.
- Encoding: Appends hidden data after encoding the main value.
- Decoding: Skips the hidden suffix after decoding the main value.
This is useful for any implicit metadata that should be present in binary formats but omitted from the API.
Type Parameters
Type Parameter | Description |
---|---|
TFrom | The type of the main value being encoded. |
TTo | The type of the main value being decoded. |
Parameters
Parameter | Type | Description |
---|---|---|
codec | Codec <TFrom , TTo > | The codec for the main value. |
suffixedCodecs | readonly Codec <void >[] | A list of void codecs that produce the hidden suffix. |
Returns
VariableSizeCodec
<TFrom
, TTo
>
A FixedSizeCodec
or VariableSizeCodec
for encoding and decoding values with a hidden suffix.
Example
Encoding and decoding a value with suffixed constants.
Remarks
If all you need is padding zeroes after a value, consider using padRightCodec instead.
Separate getHiddenSuffixEncoder and getHiddenSuffixDecoder functions are available.