public class DebugInputBitStream extends InputBitStream
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:
avail, buffer, DEFAULT_BUFFER_SIZE, DELTA, fileChannel, fill, GAMMA, is, pos, position, repositionableStream, SHIFTED_GAMMA, wrapping, ZETA_3| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
hasNext, mark, markSupported, nextBoolean, readDeltas, readGammas, readLongShiftedGamma, readShiftedGamma, readShiftedGammas, readZetas, skipDeltas, skipGammas, skipShiftedGammas, skipZetaspublic 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.public void align()
InputBitStreamalign in class InputBitStreampublic long available()
throws IOException
InputBitStreamavailable in class InputBitStreamIOExceptionpublic void close()
throws IOException
InputBitStreamclose in interface Closeableclose in interface AutoCloseableclose 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 InputBitStreampublic 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).
position in class InputBitStreamposition - the new position expressed as a bit offset.IOExceptionFileChannel.position(long)public void read(byte[] bits,
int len)
throws IOException
InputBitStreamread in class InputBitStreambits - an array of bytes to store the result.len - the number of bits to read.IOExceptionpublic int readBit()
throws IOException
InputBitStreamreadBit in class InputBitStreamIOExceptionpublic long readBits()
InputBitStreamreadBits 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
InputBitStreamreadDelta in class InputBitStreamIOExceptionOutputBitStream.writeDelta(int),
InputBitStream.skipDeltas(int)public int readGamma()
throws IOException
InputBitStreamreadGamma 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
InputBitStreamreadInt in class InputBitStreamlen - a bit length.len bits are taken from the stream; the rest is zeroed.IOExceptionpublic long readLong(int len)
throws IOException
InputBitStreamreadLong in class InputBitStreamlen - a bit length.len bits are taken from the stream; the rest is zeroed.IOExceptionpublic long readLongDelta()
throws IOException
InputBitStreamreadLongDelta in class InputBitStreamIOExceptionOutputBitStream.writeDelta(int),
InputBitStream.skipDeltas(int)public long readLongGamma()
throws IOException
InputBitStreamreadLongGamma 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
InputBitStreamreadLongMinimalBinary in class InputBitStreamb - a strict upper bound.IOExceptionOutputBitStream.writeMinimalBinary(int, int)public long readLongNibble()
throws IOException
InputBitStreamreadLongNibble 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
InputBitStreamreadLongUnary in class InputBitStreamIOExceptionOutputBitStream.writeUnary(int)public long readLongZeta(int k)
throws IOException
InputBitStreamreadLongZeta 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
InputBitStreamreadMinimalBinary in class InputBitStreamb - a strict upper bound.IOExceptionOutputBitStream.writeMinimalBinary(int, int)public int readNibble()
throws IOException
InputBitStreamreadNibble 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
InputBitStreamreadUnary in class InputBitStreamIOExceptionOutputBitStream.writeUnary(int)public int readZeta(int k)
throws IOException
InputBitStreamreadZeta 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)
InputBitStreamskip in interface it.unimi.dsi.fastutil.booleans.BooleanIteratorskip in class InputBitStreamn - the number of bits to skip.public long skip(long n)
throws IOException
InputBitStreamskip in class InputBitStreamn - the number of bits to skip.IOExceptionCopyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.