Functions
padRightCodec
padRightCodec<
TCodec
>(codec
,offset
):TCodec
Adds right padding to the given codec, extending the encoded and decoded value
by offset
bytes whilst increasing the size of the codec accordingly.
The extra bytes remain unused, ensuring that the next operation starts further along the byte array.
Type Parameters
Type Parameter |
---|
TCodec extends AnyCodec |
Parameters
Parameter | Type | Description |
---|---|---|
codec | TCodec | The codec to pad. |
offset | number | The number of padding bytes to add after encoding and decoding. |
Returns
TCodec
A new codec with right padding applied.
Example
Remarks
If you only need to apply padding for encoding, use padRightEncoder. If you only need to apply padding for decoding, use padRightDecoder.