Package it.unimi.dsi.mg4j.io

Bit-level I/O classes.

See:
          Description

Class Summary
ArithmeticCoder An arithmetic coder.
ArithmeticDecoder An arithmetic decoder.
ByteArrayPostingList Lightweight posting accumulator with format similar to that generated by BitStreamIndexWriter.
InterpolativeCoding Static methods implementing interpolative coding.
 

Package it.unimi.dsi.mg4j.io Description

Bit-level I/O classes.

Package Specification

The standard Java API lacks bit-level I/O classes: to this purpose, MG4J provides mg4j.io.InputBitStream and mg4j.io.OutputBitStream, which can wrap any standard Java corresponding stream and make it work at the bit level; moreover, they provide support for several useful formats (such as unary, binary, minimal binary, γ, δ and Golomb encoding).

Compression can be achieved using self-delimiting formats supported by the classes above, or also by arithmetic coding, using the classes ArithmeticCoder and ArithmeticDecoder. Note that arithmetic coding is not very efficient in the present implementation, as it does not allow a varying number of symbols.

Bit input and output streams offer also efficient buffering and a way to reposition the bit stream in case the underlying byte stream is a file-based stream or a RepositionableStream.

Conventions

All coding methods work on natural numbers. The encoding of zero is very natural for some techniques, and much less natural for others. To keep methods rationally organised, all methods are able to encode any natural number. If, for instance, you want to write positive numbers in unary encoding and you do not want to waste a bit, you have to decrement them first (i.e., instead of p you must encode p−1).