Pike v8.0 release 1738

Class ADT.BitBuffer

Description

Implements a FIFO bit buffer, i.e. a buffer that operates on bits instead of bytes. It is not designed for performance, but as a way to handle complicated file formats and other standards where you may need to work on unaligned data units of sub byte size, without having to fry your brain while keeping track of all the bits yourself.

Example

> ADT.BitBuffer b=ADT.BitBuffer(); > b->put1(2); (1) Result: ADT.BitBuffer(11) > b->put0(15); (2) Result: ADT.BitBuffer("\300\0"0) > b->drain(); (3) Result: "\300\0" > sizeof(b); (4) Result: 1


Method create

ADT.BitBuffer ADT.BitBuffer(void|string data)

Description

The buffer can be initialized with initial data during creation.