public abstract class BitInBase extends Object implements BitIn
Modifier and Type | Field and Description |
---|---|
protected int |
bitOffset
bit offset in this byte, and in the larger file
|
protected byte |
byteRead
current byte
|
protected long |
offset
offset in the larger file
|
USUAL_EXTENSION
Constructor and Description |
---|
BitInBase() |
Modifier and Type | Method and Description |
---|---|
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.
|
protected abstract void |
incrByte()
Move forward one byte.
|
protected abstract void |
incrByte(int i)
Move forward i bytes.
|
int |
readBinary(int len)
Reads a binary integer from the already read buffer.
|
int |
readDelta()
Reads a delta encoded integer from the underlying stream
|
int |
readGamma()
Reads a gamma encoded integer from the underlying stream
|
int |
readGolomb(int b)
Reads a Golomb encoded integer
|
protected void |
readIn()
Reads a new byte from the InputStream if we have finished with the current one.
|
void |
readInterpolativeCoding(int[] data,
int localoffset,
int len,
int lo,
int hi)
Reads a sequence of numbers from the stream interpolative coded.
|
int |
readMinimalBinary(int b)
Reads a binary encoded integer, given an upper bound
|
int |
readMinimalBinaryZero(int b)
Reads a minimal binary encoded number, when the upper bound can b zero.
|
int |
readSkewedGolomb(int b)
Reads a skewed-golomb encoded integer from the underlying stream
Consider a bucket-vector
v = <0, 2b, 4b, ... |
int |
readUnary()
Reads a unary encoded integer from the underlying stream
|
void |
skipBits(int len)
Skip a number of bits in the current input stream
|
protected int bitOffset
protected long offset
protected byte byteRead
public long getByteOffset()
getByteOffset
in interface BitIn
public byte getBitOffset()
getBitOffset
in interface BitIn
public int readUnary() throws IOException
readUnary
in interface BitIn
IOException
- if an I/O error occurspublic int readBinary(int len) throws IOException
readBinary
in interface BitIn
len
- the number of binary bits to readIOException
- if an I/O error occurspublic int readDelta() throws IOException
readDelta
in interface BitIn
IOException
- if an I/O error occurspublic int readGamma() throws IOException
readGamma
in interface BitIn
IOException
- if an I/O error occurspublic int readSkewedGolomb(int b) throws IOException
v = <0, 2b, 4b, ... , 2^i b, ...>
The sum of the elements in the vector goes
b, 3b, 7b, 2^(i-1)*b
readSkewedGolomb
in interface BitIn
IOException
- if an I/O error occurspublic int readGolomb(int b) throws IOException
readGolomb
in interface BitIn
b
- the golomb modulusIOException
- if and I/O error occurspublic int readMinimalBinary(int b) throws IOException
readMinimalBinary
in interface BitIn
b
- the upper boundIOException
- if an I/O error occurspublic int readMinimalBinaryZero(int b) throws IOException
readMinimalBinaryZero
in interface BitIn
b
- the upper boundIOException
- if an I/O error occurspublic void readInterpolativeCoding(int[] data, int localoffset, int len, int lo, int hi) throws IOException
readInterpolativeCoding
in interface BitIn
data
- the result vectorlocaloffset
- offset where to write in the vectorlen
- the number of integers to decode.lo
- a lower bound (the same one passed to writeInterpolativeCoding)hi
- an upper bound (the same one passed to writeInterpolativeCoding)IOException
- if an I/O error occurspublic void skipBits(int len) throws IOException
skipBits
in interface BitIn
len
- The number of bits to skipIOException
- if an I/O error occurspublic void align() throws IOException
align
in interface BitIn
IOException
- if an I/O error occursprotected abstract void incrByte() throws IOException
IOException
protected abstract void incrByte(int i) throws IOException
IOException
protected void readIn() throws IOException
IOException
Terrier Information Retrieval Platform 5.1. Copyright © 2004-2019, University of Glasgow