reverseDecoder
Reverses the bytes of a fixed-size decoder.
Given a FixedSizeDecoder, this function returns a new FixedSizeDecoder that
reverses the bytes within the fixed-size byte array before decoding.
This can be useful to modify endianness or for other byte-order transformations.
For more details, see reverseCodec.
Type Parameters
| Type Parameter | Description |
|---|---|
TTo | The type of the decoded value. |
TSize extends number | The fixed size of the decoded value in bytes. |
Parameters
| Parameter | Type | Description |
|---|---|---|
decoder | FixedSizeDecoder<TTo, TSize> | The fixed-size decoder to reverse. |
Returns
FixedSizeDecoder<TTo, TSize>
A new decoder that reads bytes in reverse order.
Example
Decoding a reversed u16 value.