public class BitInputStream extends Object
| Constructor and Description |
|---|
BitInputStream(InputStream is)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
bitsLeftForByteAlignment()
return the number of bits to read to align the byte.
|
int |
getInputBytesUnconsumed()
return the number of bytes left to read.
|
short |
getReadCRC16()
return the read CRC-16 value.
|
int |
getTotalBytesRead()
Total Blurbs read.
|
boolean |
isConsumedByteAligned()
Test if the Bit Stream consumed bits is byte aligned.
|
int |
peekBitToInt(int val,
int bit)
peek at the next bit and add it to the input integer.
|
int |
peekRawUInt(int bits)
peek at bits into an unsigned integer without advancing the input stream.
|
int |
readBit()
read a single bit.
|
int |
readBitToInt(int val)
read a bit into an integer value.
|
long |
readBitToLong(long val)
read a bit into a long value.
|
void |
readByteBlockAlignedNoCRC(byte[] val,
int nvals)
Read a block of bytes (aligned) without updating the CRC value.
|
int |
readRawInt(int bits)
read bits into a signed integer.
|
int |
readRawIntLittleEndian()
read bits into an unsigned little endian integer.
|
int |
readRawUInt(int bits)
read bits into an unsigned integer.
|
long |
readRawULong(int bits)
read bits into an unsigned long.
|
void |
readRiceSignedBlock(int[] vals,
int pos,
int nvals,
int parameter)
Read a Rice Signal Block.
|
int |
readUnaryUnsigned()
Read and count the number of zero bits.
|
int |
readUTF8Int(ByteData raw)
read UTF8 integer.
|
long |
readUTF8Long(ByteData raw)
read UTF long.
|
void |
reset()
Reset the bit stream.
|
void |
resetReadCRC16(short seed)
Reset the read CRC-16 value.
|
void |
skipBitsNoCRC(int bits)
skip over bits in bit stream without updating CRC.
|
public BitInputStream(InputStream is)
is - The InputStream to read bits frompublic void reset()
public void resetReadCRC16(short seed)
seed - The initial CRC-16 valuepublic short getReadCRC16()
public boolean isConsumedByteAligned()
public int bitsLeftForByteAlignment()
public int getInputBytesUnconsumed()
public void skipBitsNoCRC(int bits)
throws IOException
bits - Number of bits to skipIOException - Thrown if error reading from input streampublic int readBit()
throws IOException
IOException - Thrown if error reading input streampublic int readBitToInt(int val)
throws IOException
val - The integer to shift and add read bitIOException - Thrown if error reading input streampublic int peekBitToInt(int val,
int bit)
throws IOException
val - The input integerbit - The bit to peek atIOException - Thrown if error reading input streampublic long readBitToLong(long val)
throws IOException
val - The long to shift and add read bitIOException - Thrown if error reading input streampublic int readRawUInt(int bits)
throws IOException
bits - The number of bits to readIOException - Thrown if error reading input streampublic int peekRawUInt(int bits)
throws IOException
bits - The number of bits to readIOException - Thrown if error reading input streampublic int readRawInt(int bits)
throws IOException
bits - The number of bits to readIOException - Thrown if error reading input streampublic long readRawULong(int bits)
throws IOException
bits - The number of bits to readIOException - Thrown if error reading input streampublic int readRawIntLittleEndian()
throws IOException
IOException - Thrown if error reading input streampublic void readByteBlockAlignedNoCRC(byte[] val,
int nvals)
throws IOException
val - The array to receive the bytes. If null, no bytes are returnednvals - The number of bytes to readIOException - Thrown if error reading input streampublic int readUnaryUnsigned()
throws IOException
IOException - Thrown if error reading input streampublic void readRiceSignedBlock(int[] vals,
int pos,
int nvals,
int parameter)
throws IOException
vals - The values to be returnedpos - The starting position in the vals arraynvals - The number of values to returnparameter - The Rice parameterIOException - On read errorpublic int readUTF8Int(ByteData raw) throws IOException
raw - The raw bytes read (output). If null, no bytes are returnedIOException - Thrown if error reading input streampublic long readUTF8Long(ByteData raw) throws IOException
raw - The raw bytes read (output). If null, no bytes are returnedIOException - Thrown if error reading input streampublic int getTotalBytesRead()
Copyright © 2004–2017. All rights reserved.