public class BitReader
extends java.lang.Object
Constructor and Description |
---|
BitReader(byte[] test) |
BitReader(RandomAccessFile raf,
long startPos)
Constructor
|
Modifier and Type | Method and Description |
---|---|
long |
bits2SInt(int nb)
Read the next nb bits and return an Signed Long .
|
long |
bits2UInt(int nb)
Read the next nb bits and return an Unsigned Long .
|
static boolean |
getBit(long decimal,
int N) |
long |
getPos() |
void |
incrByte()
Go to the next byte in the stream
|
static long |
setBit(long decimal,
int N,
boolean value) |
void |
setBitOffset(int bitOffset)
Position file at bitOffset from startPos
|
public BitReader(byte[] test)
public BitReader(RandomAccessFile raf, long startPos) throws java.io.IOException
raf
- the RandomAccessFilestartPos
- points to start of data in data section, in bytesjava.io.IOException
- on read errorpublic long bits2SInt(int nb) throws java.io.IOException
nb
- the number of bits to convert to int, must be <= 64.java.io.IOException
- on read errorpublic long bits2UInt(int nb) throws java.io.IOException
nb
- the number of bits to convert to int, must be 0 <= nb <= 64.java.io.IOException
- on read errorpublic static boolean getBit(long decimal, int N)
public long getPos()
public void incrByte()
public static long setBit(long decimal, int N, boolean value)
public void setBitOffset(int bitOffset) throws java.io.IOException
bitOffset
- bit offset from starting positionjava.io.IOException
- on io error