|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object loci.formats.codec.BitBuffer
public class BitBuffer
A class for reading arbitrary numbers of bits from a byte array.
Constructor Summary | |
---|---|
BitBuffer(byte[] byteBuffer)
Default constructor. |
Method Summary | |
---|---|
int |
getBits(int bitsToRead)
Returns an int value representing the value of the bits read from the byte array, from the current position. |
static void |
main(String[] args)
Testing method. |
void |
skipBits(long bits)
Skips a number of bits in the BitBuffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BitBuffer(byte[] byteBuffer)
Method Detail |
---|
public void skipBits(long bits)
bits
- Number of bits to skippublic int getBits(int bitsToRead)
The current position is modified by this call.
Bits are pushed into the int from the right, endianness is not considered by the method on its own. So, if 5 bits were read from the buffer "10101", the int would be the integer representation of 000...0010101 on the target machine.
In general, this also means the result will be positive unless a full 32 bits are read.
Requesting more than 32 bits is allowed, but only up to 32 bits worth of data will be returned (the last 32 bits read).
bitsToRead
- the number of bits to read from the bit buffer
public static void main(String[] args)
args
- Ignored.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |