Crinch Bits Library

The Crinch bits library provides a consistent and carefully considered abstraction for reading and writing data at bit level. In addition to this, an extremely powerful class for manipulating fixed-length bit sequences is provided that complements the available reader/writer implementations.


The backbone of the package consists of two interfaces and a concrete class, respectively:

See the Javadocs to find out more about the methods each class exposes.

The rest of the package mostly consists of concrete pairs of BitReader/BitWriter implementations:

Finally the FileBitReaderFactory class is useful for reading bits from a specified file; different modes are available with different memory/performance tradeoffs.

For developers looking to implement their own BitReader and BitWriter implementations, the AbstractBitReader and AbstractBitWriter classes reduce the task to the implementation of a single method. ByteBasedBitReader and ByteBasedBitWriter simplify the task still further in the common case where the bits are being stored byte-by-byte.

More Documentation

In addition to the Javadocs, there are more examples and tutorials for the BitVector class on my blog.

Licencing and Availability

See information about Crinch

* These classes are not available yet and will be included in a later release.