Package it.unimi.dsi.mg4j.io

Bit-level I/O classes.

See:
          Description

Interface Summary
SafelyCloseable Deprecated. Moved to dsiutils.
WordReader Deprecated. Moved to dsiutils.
 

Class Summary
ArithmeticCoder An arithmetic coder.
ArithmeticDecoder An arithmetic decoder.
ByteArrayPostingList Lightweight posting accumulator with format similar to that generated by BitStreamIndexWriter.
ByteBufferInputStream Deprecated. Moved to dsiutils.
DebugInputBitStream Deprecated. Moved to dsiutils.
DebugOutputBitStream Deprecated. Moved to dsiutils.
FastBufferedReader Deprecated. Moved to dsiutils.
FastByteArrayInputStream Deprecated. Moved to fastutil.
FastByteArrayOutputStream Deprecated. Moved to fastutil.
FastMultiByteArrayInputStream Deprecated. Moved to fastutil.
FileLinesCollection Deprecated. Moved to dsiutils.
FileLinesCollection.FileLinesIterator An iterator over the lines of a FileLinesCollection.
InputBitStream Deprecated. Moved to dsiutils.
InterpolativeCoding Static methods implementing interpolative coding.
LineIterator Deprecated. Moved to dsiutils.
LineWordReader Deprecated. Moved to dsiutils.
MultipleInputStream Deprecated. Moved to dsiutils.
NullInputStream Deprecated. Moved to dsiutils.
NullOutputStream Deprecated. Moved to dsiutils.
NullReader Deprecated. Moved to dsiutils.
OutputBitStream Deprecated. Moved to dsiutils.
SegmentedInputStream Deprecated. Moved to dsiutils.
 

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 InputBitStream and 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).