Terrier IR Platform
2.2.1

uk.ac.gla.terrier.compression
Interface BitIn

All Superinterfaces:
java.io.Closeable
All Known Implementing Classes:
BitFile, BitInputStream, OldBitFile, OldBitInputStream

public interface BitIn
extends java.io.Closeable

Interface describing the read compression methods supported by the BitFile and BitInputStream classes.

Since:
2.0
Version:
$Revision: 1.4 $
Author:
Craig Macdonald

Method Summary
 void align()
          Aligns the stream to the next byte
 byte getBitOffset()
          Returns the bit offset in the last byte.
 long getByteOffset()
          Returns the byte offset of the stream.
 int readBinary(int len)
          Reads a binary integer from the already read buffer.
 int readGamma()
          Reads a gamma encoded integer from the underlying stream
 int readUnary()
          Reads a unary encoded integer from the underlying stream
 void skipBits(int len)
          Skip a number of bits while reading the bit file.
 
Methods inherited from interface java.io.Closeable
close
 

Method Detail

getByteOffset

long getByteOffset()
Returns the byte offset of the stream. It corresponds to the position of the byte in which the next bit will be written. Use only when writting

Returns:
the byte offset in the stream.

getBitOffset

byte getBitOffset()
Returns the bit offset in the last byte. It corresponds to the position in which the next bit will be written. Use only when writting.

Returns:
the bit offset in the stream.

readUnary

int readUnary()
              throws java.io.IOException
Reads a unary encoded integer from the underlying stream

Returns:
the number read
Throws:
java.io.IOException - if an I/O error occurs

readGamma

int readGamma()
              throws java.io.IOException
Reads a gamma encoded integer from the underlying stream

Returns:
the number read
Throws:
java.io.IOException - if an I/O error occurs

readBinary

int readBinary(int len)
               throws java.io.IOException
Reads a binary integer from the already read buffer.

Parameters:
len - the number of binary bits to read
Returns:
the decoded integer
Throws:
java.io.IOException - if an I/O error occurs

skipBits

void skipBits(int len)
              throws java.io.IOException
Skip a number of bits while reading the bit file.

Parameters:
len - The number of bits to skip
Throws:
java.io.IOException - if an I/O error occurs

align

void align()
           throws java.io.IOException
Aligns the stream to the next byte

Throws:
java.io.IOException - if an I/O error occurs

Terrier IR Platform
2.2.1

Terrier Information Retrieval Platform 2.2.1. Copyright 2004-2008 University of Glasgow