|
|||||||||
| 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,
java.io.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, skipGammas, skipShiftedGammas, 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,
java.io.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 java.io.IOException
InputBitStream
available in class InputBitStreamjava.io.IOException
public void close()
throws java.io.IOException
InputBitStream
close in interface java.io.Closeableclose in class InputBitStreamjava.io.IOExceptionpublic 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 java.io.Flushableflush in class InputBitStream
public void position(long position)
throws java.io.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).
position in class InputBitStreamposition - the new position expressed as a bit offset.
java.io.IOExceptionFileChannel.position(long)
public void read(byte[] bits,
int len)
throws java.io.IOException
InputBitStream
read in class InputBitStreambits - an array of bytes to store the result.len - the number of bits to read.
java.io.IOException
public int readBit()
throws java.io.IOException
InputBitStream
readBit in class InputBitStreamjava.io.IOExceptionpublic 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 java.io.IOException
InputBitStream
readDelta in class InputBitStreamjava.io.IOExceptionOutputBitStream.writeDelta(int),
InputBitStream.skipDeltas(int)
public int readGamma()
throws java.io.IOException
InputBitStream
readGamma in class InputBitStreamjava.io.IOExceptionOutputBitStream.writeGamma(int),
InputBitStream.skipGammas(int)
public int readGolomb(int b,
int log2b)
throws java.io.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.
java.io.IOExceptionOutputBitStream.writeGolomb(int, int)
public int readGolomb(int b)
throws java.io.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.
java.io.IOExceptionOutputBitStream.writeGolomb(int, int)
public int readInt(int len)
throws java.io.IOException
InputBitStream
readInt in class InputBitStreamlen - a bit length.
len bits are taken from the stream; the rest is zeroed.
java.io.IOException
public long readLong(int len)
throws java.io.IOException
InputBitStream
readLong in class InputBitStreamlen - a bit length.
len bits are taken from the stream; the rest is zeroed.
java.io.IOException
public long readLongDelta()
throws java.io.IOException
InputBitStream
readLongDelta in class InputBitStreamjava.io.IOExceptionOutputBitStream.writeDelta(int),
InputBitStream.skipDeltas(int)
public long readLongGamma()
throws java.io.IOException
InputBitStream
readLongGamma in class InputBitStreamjava.io.IOExceptionOutputBitStream.writeGamma(int),
InputBitStream.skipGammas(int)
public long readLongGolomb(long b,
int log2b)
throws java.io.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.
java.io.IOExceptionOutputBitStream.writeGolomb(int, int)
public long readLongGolomb(long b)
throws java.io.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.
java.io.IOExceptionOutputBitStream.writeGolomb(int, int)
public long readLongMinimalBinary(long b,
int log2b)
throws java.io.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.
java.io.IOExceptionOutputBitStream.writeMinimalBinary(int, int)
public long readLongMinimalBinary(long b)
throws java.io.IOException
InputBitStream
readLongMinimalBinary in class InputBitStreamb - a strict upper bound.
java.io.IOExceptionOutputBitStream.writeMinimalBinary(int, int)
public long readLongNibble()
throws java.io.IOException
InputBitStream
readLongNibble in class InputBitStreamjava.io.IOExceptionOutputBitStream.writeNibble(int)
public long readLongSkewedGolomb(long b)
throws java.io.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.
java.io.IOExceptionOutputBitStream.writeSkewedGolomb(int, int)
public long readLongUnary()
throws java.io.IOException
InputBitStream
readLongUnary in class InputBitStreamjava.io.IOExceptionOutputBitStream.writeUnary(int)
public long readLongZeta(int k)
throws java.io.IOException
InputBitStream
readLongZeta in class InputBitStreamk - the shrinking factor.
java.io.IOExceptionOutputBitStream.writeZeta(int, int)
public int readMinimalBinary(int b,
int log2b)
throws java.io.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.
java.io.IOExceptionOutputBitStream.writeMinimalBinary(int, int)
public int readMinimalBinary(int b)
throws java.io.IOException
InputBitStream
readMinimalBinary in class InputBitStreamb - a strict upper bound.
java.io.IOExceptionOutputBitStream.writeMinimalBinary(int, int)
public int readNibble()
throws java.io.IOException
InputBitStream
readNibble in class InputBitStreamjava.io.IOExceptionOutputBitStream.writeNibble(int)
public int readSkewedGolomb(int b)
throws java.io.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.
java.io.IOExceptionOutputBitStream.writeSkewedGolomb(int, int)
public int readUnary()
throws java.io.IOException
InputBitStream
readUnary in class InputBitStreamjava.io.IOExceptionOutputBitStream.writeUnary(int)
public int readZeta(int k)
throws java.io.IOException
InputBitStream
readZeta in class InputBitStreamk - the shrinking factor.
java.io.IOExceptionOutputBitStream.writeZeta(int, int)
public void reset()
throws java.io.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 InputBitStreamjava.io.IOException@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 java.io.IOException
InputBitStream
skip in class InputBitStreamn - the number of bits to skip.
java.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||