Extracted from Pike v7.8 release 866 at 2016-11-06.
pike.ida.liu.se
[Top]
ADT
ADT.BitBuffer

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("À\0"0) > b->drain(); (3) Result: "À\0" > sizeof(b); (4) Result: 1