|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectit.unimi.dsi.fastutil.booleans.AbstractBooleanIterator
it.unimi.dsi.io.InputBitStream
it.unimi.dsi.io.DebugInputBitStream
public class DebugInputBitStream
A debugging wrapper for input bit streams.
This class can be used to wrap an input bit stream. The semantics of the
resulting read operations is unchanged, but each operation will be logged. The
conventions are the same as those of DebugOutputBitStream,
with the following additions:
reset();
skip().
| Field Summary |
|---|
| Fields inherited from class it.unimi.dsi.io.InputBitStream |
|---|
avail, buffer, DEFAULT_BUFFER_SIZE, DELTA, fileChannel, fill, GAMMA, is, pos, position, repositionableStream, SHIFTED_GAMMA, wrapping, ZETA_3 |
| Constructor Summary | |
|---|---|
DebugInputBitStream(InputBitStream ibs)
Creates a new debug input bit stream wrapping a given input bit stream and logging on standard error. |
|
DebugInputBitStream(InputBitStream ibs,
PrintStream pw)
Creates a new debug input bit stream wrapping a given input bit stream and logging on a given writer. |
|
| Method Summary | |
|---|---|
void |
align()
Aligns the stream. |
long |
available()
Returns the number of bits that can be read (or skipped over) from this bit stream without blocking by the next caller of a method. |
void |
close()
Closes the bit stream. |
void |
flush()
Flushes the bit stream. |
void |
position(long position)
Sets this stream bit position, if it is based on a RepositionableStream or on a FileChannel. |
void |
read(byte[] bits,
int len)
Reads a sequence of bits. |
int |
readBit()
Reads a bit. |
long |
readBits()
Returns the number of bits read from this bit stream. |
void |
readBits(long readBits)
Sets the number of bits read from this bit stream. |
int |
readDelta()
Reads a natural number in δ coding. |
int |
readGamma()
Reads a natural number in γ coding. |
int |
readGolomb(int b)
Reads a natural number in Golomb coding. |
int |
readGolomb(int b,
int log2b)
Reads a natural number in Golomb coding. |
int |
readInt(int len)
Reads a fixed number of bits into an integer. |
long |
readLong(int len)
Reads a fixed number of bits into a long. |
long |
readLongDelta()
Reads a long natural number in δ coding. |
long |
readLongGamma()
Reads a long natural number in γ coding. |
long |
readLongGolomb(long b)
Reads a long natural number in Golomb coding. |
long |
readLongGolomb(long b,
int log2b)
Reads a long natural number in Golomb coding. |
long |
readLongMinimalBinary(long b)
Reads a long natural number in a limited range using a minimal binary coding. |
long |
readLongMinimalBinary(long b,
int log2b)
Reads a long natural number in a limited range using a minimal binary coding. |
long |
readLongNibble()
Reads a long natural number in variable-length nibble coding. |
long |
readLongSkewedGolomb(long b)
Reads a long natural number in skewed Golomb coding. |
long |
readLongUnary()
Reads a long natural number in unary coding. |
long |
readLongZeta(int k)
Reads a long natural number in ζ coding. |
int |
readMinimalBinary(int b)
Reads a natural number in a limited range using a minimal binary coding. |
int |
readMinimalBinary(int b,
int log2b)
Reads a natural number in a limited range using a minimal binary coding. |
int |
readNibble()
Reads a natural number in variable-length nibble coding. |
int |
readSkewedGolomb(int b)
Reads a natural number in skewed Golomb coding. |
int |
readUnary()
Reads a natural number in unary coding. |
int |
readZeta(int k)
Reads a natural number in ζ coding. |
void |
reset()
Repositions this bit stream to the position at the time the InputBitStream.mark(int) method was last called. |
int |
skip(int n)
Deprecated. |
long |
skip(long n)
Skips the given number of bits. |
| Methods inherited from class it.unimi.dsi.io.InputBitStream |
|---|
hasNext, mark, markSupported, nextBoolean, readDeltas, readGammas, readLongShiftedGamma, readShiftedGamma, readShiftedGammas, readZetas, skipDeltas, skipDeltas, skipGammas, skipGammas, skipShiftedGammas, skipShiftedGammas, skipZetas, skipZetas |
| Methods inherited from class it.unimi.dsi.fastutil.booleans.AbstractBooleanIterator |
|---|
next, remove |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DebugInputBitStream(InputBitStream ibs,
PrintStream pw)
ibs - the input bit stream to wrap.pw - a print stream that will receive the logging data.public DebugInputBitStream(InputBitStream ibs)
ibs - the input bit stream to wrap.| Method Detail |
|---|
public void align()
InputBitStream
align in class InputBitStream
public long available()
throws IOException
InputBitStream
available in class InputBitStreamIOException
public void close()
throws IOException
InputBitStream
close in interface Closeableclose in class InputBitStreamIOExceptionpublic void flush()
InputBitStreamThis method is provided so that users of this class can easily wrap repositionable
streams (for instance, file-based streams, which can be repositioned using
the underlying FileChannel). It is guaranteed that after calling
this method the underlying stream can be repositioned, and that the next read
will draw data from the stream.
flush in interface Flushableflush in class InputBitStream
public void position(long position)
throws IOException
InputBitStreamRepositionableStream or on a FileChannel.
Given an underlying stream that implements RepositionableStream or that can provide a FileChannel via the getChannel() method,
a call to this method has the same semantics of a InputBitStream.flush(),
followed by a call to position(position / 8) on
the byte stream, followed by a skip(position % 8).
Note that this method does not change the value returned by InputBitStream.readBits().
position in class InputBitStreamposition - the new position expressed as a bit offset.
IOExceptionFileChannel.position(long)
public void read(byte[] bits,
int len)
throws IOException
InputBitStream
read in class InputBitStreambits - an array of bytes to store the result.len - the number of bits to read.
IOException
public int readBit()
throws IOException
InputBitStream
readBit in class InputBitStreamIOExceptionpublic long readBits()
InputBitStream
readBits in class InputBitStreampublic void readBits(long readBits)
InputBitStreamThis method is provided so that, for instance, the
user can reset via readBits(0) the read-bits count
after a InputBitStream.flush().
readBits in class InputBitStreamreadBits - the new value for the number of bits read so far.
public int readDelta()
throws IOException
InputBitStream
readDelta in class InputBitStreamIOExceptionOutputBitStream.writeDelta(int),
InputBitStream.skipDeltas(int)
public int readGamma()
throws IOException
InputBitStream
readGamma in class InputBitStreamIOExceptionOutputBitStream.writeGamma(int),
InputBitStream.skipGammas(int)
public int readGolomb(int b,
int log2b)
throws IOException
InputBitStreamInputBitStream.readGolomb(int) because it does not
have to compute log2b.
This method implements also the case in which b is 0: in this case,
nothing will be read, and 0 will be returned.
readGolomb in class InputBitStreamb - the modulus for the coding.log2b - the floor of the base-2 logarithm of the coding modulus.
IOExceptionOutputBitStream.writeGolomb(int, int)
public int readGolomb(int b)
throws IOException
InputBitStreamThis method implements also the case in which b is 0: in this case,
nothing will be read, and 0 will be returned.
readGolomb in class InputBitStreamb - the modulus for the coding.
IOExceptionOutputBitStream.writeGolomb(int, int)
public int readInt(int len)
throws IOException
InputBitStream
readInt in class InputBitStreamlen - a bit length.
len bits are taken from the stream; the rest is zeroed.
IOException
public long readLong(int len)
throws IOException
InputBitStream
readLong in class InputBitStreamlen - a bit length.
len bits are taken from the stream; the rest is zeroed.
IOException
public long readLongDelta()
throws IOException
InputBitStream
readLongDelta in class InputBitStreamIOExceptionOutputBitStream.writeDelta(int),
InputBitStream.skipDeltas(int)
public long readLongGamma()
throws IOException
InputBitStream
readLongGamma in class InputBitStreamIOExceptionOutputBitStream.writeGamma(int),
InputBitStream.skipGammas(int)
public long readLongGolomb(long b,
int log2b)
throws IOException
InputBitStreamInputBitStream.readLongGolomb(long) because it does not
have to compute log2b.
This method implements also the case in which b is 0: in this case,
nothing will be read, and 0 will be returned.
readLongGolomb in class InputBitStreamb - the modulus for the coding.log2b - the floor of the base-2 logarithm of the coding modulus.
IOExceptionOutputBitStream.writeGolomb(int, int)
public long readLongGolomb(long b)
throws IOException
InputBitStreamThis method implements also the case in which b is 0: in this case,
nothing will be read, and 0 will be returned.
readLongGolomb in class InputBitStreamb - the modulus for the coding.
IOExceptionOutputBitStream.writeGolomb(int, int)
public long readLongMinimalBinary(long b,
int log2b)
throws IOException
InputBitStreamInputBitStream.readLongMinimalBinary(long) because it does not
have to compute log2b.
readLongMinimalBinary in class InputBitStreamb - a strict upper bound.log2b - the floor of the base-2 logarithm of the bound.
IOExceptionOutputBitStream.writeMinimalBinary(int, int)
public long readLongMinimalBinary(long b)
throws IOException
InputBitStream
readLongMinimalBinary in class InputBitStreamb - a strict upper bound.
IOExceptionOutputBitStream.writeMinimalBinary(int, int)
public long readLongNibble()
throws IOException
InputBitStream
readLongNibble in class InputBitStreamIOExceptionOutputBitStream.writeNibble(int)
public long readLongSkewedGolomb(long b)
throws IOException
InputBitStreamThis method implements also the case in which b is 0: in this case,
nothing will be read, and 0 will be returned.
readLongSkewedGolomb in class InputBitStreamb - the modulus for the coding.
IOExceptionOutputBitStream.writeSkewedGolomb(int, int)
public long readLongUnary()
throws IOException
InputBitStream
readLongUnary in class InputBitStreamIOExceptionOutputBitStream.writeUnary(int)
public long readLongZeta(int k)
throws IOException
InputBitStream
readLongZeta in class InputBitStreamk - the shrinking factor.
IOExceptionOutputBitStream.writeZeta(int, int)
public int readMinimalBinary(int b,
int log2b)
throws IOException
InputBitStreamInputBitStream.readMinimalBinary(int) because it does not
have to compute log2b.
readMinimalBinary in class InputBitStreamb - a strict upper bound.log2b - the floor of the base-2 logarithm of the bound.
IOExceptionOutputBitStream.writeMinimalBinary(int, int)
public int readMinimalBinary(int b)
throws IOException
InputBitStream
readMinimalBinary in class InputBitStreamb - a strict upper bound.
IOExceptionOutputBitStream.writeMinimalBinary(int, int)
public int readNibble()
throws IOException
InputBitStream
readNibble in class InputBitStreamIOExceptionOutputBitStream.writeNibble(int)
public int readSkewedGolomb(int b)
throws IOException
InputBitStreamThis method implements also the case in which b is 0: in this case,
nothing will be read, and 0 will be returned.
readSkewedGolomb in class InputBitStreamb - the modulus for the coding.
IOExceptionOutputBitStream.writeSkewedGolomb(int, int)
public int readUnary()
throws IOException
InputBitStream
readUnary in class InputBitStreamIOExceptionOutputBitStream.writeUnary(int)
public int readZeta(int k)
throws IOException
InputBitStream
readZeta in class InputBitStreamk - the shrinking factor.
IOExceptionOutputBitStream.writeZeta(int, int)
public void reset()
throws IOException
InputBitStreamInputBitStream.mark(int) method was last called.
This method will just flush the stream and delegate
the reset to the underlying InputStream.
reset in class InputBitStreamIOException@Deprecated public int skip(int n)
InputBitStream
skip in interface BooleanIteratorskip in class InputBitStreamn - the number of bits to skip.
public long skip(long n)
throws IOException
InputBitStream
skip in class InputBitStreamn - the number of bits to skip.
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||