reverseCodec<TFrom, TTo> function
Reverses the bytes of a fixed-size codec.
Both encoding and decoding reverse bytes within the fixed-size range.
Implementation
FixedSizeCodec<TFrom, TTo> reverseCodec<TFrom, TTo>(
FixedSizeCodec<TFrom, TTo> codec,
) {
return combineCodec(
reverseEncoder(
FixedSizeEncoder<TFrom>(
fixedSize: codec.fixedSize,
write: codec.write,
),
),
reverseDecoder(
FixedSizeDecoder<TTo>(fixedSize: codec.fixedSize, read: codec.read),
),
)
as FixedSizeCodec<TFrom, TTo>;
}