public class BitReader extends 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 IOException
raf
- the RandomAccessFilestartPos
- points to start of data in data section, in bytesIOException
- on read errorpublic void incrByte()
public void setBitOffset(int bitOffset) throws IOException
bitOffset
- bit offset from starting positionIOException
- on io errorpublic long getPos()
public long bits2UInt(int nb) throws IOException
nb
- the number of bits to convert to int, must be 0 <= nb <= 64.IOException
- on read errorpublic long bits2SInt(int nb) throws IOException
nb
- the number of bits to convert to int, must be <= 64.IOException
- on read errorpublic static long setBit(long decimal, int N, boolean value)
public static boolean getBit(long decimal, int N)