getBitArrayEncoder
Returns an encoder that packs an array of booleans into bits.
This encoder converts a list of boolean values into a compact bit representation,
storing 8 booleans per byte.
The backward config option determines whether the bits are stored in MSB-first (false)
or LSB-first (true).
For more details, see getBitArrayCodec.
Type Parameters
| Type Parameter | Description |
|---|---|
TSize extends number | The number of bytes used to store the bit array. |
Parameters
| Parameter | Type | Description |
|---|---|---|
size | TSize | The number of bytes allocated for the bit array (must be sufficient for the expected boolean count). |
config? | | boolean | BitArrayCodecConfig | Configuration options for encoding the bit array. |
Returns
FixedSizeEncoder<boolean[], TSize>
A FixedSizeEncoder<boolean[], TSize> for encoding bit arrays.
Example
Encoding a bit array.