Class BitBuffer
- java.lang.Object
-
- nom.tam.fits.compression.algorithm.rice.BitBuffer
-
public class BitBuffer extends java.lang.Object
A bit wise reader writer around a bytebuffer.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
BITS_OF_1_BYTE
private static int
BITS_OF_2_BYTES
private static int
BITS_OF_3_BYTES
private static int
BITS_OF_4_BYTES
private java.nio.ByteBuffer
buffer
private static int
BYTE_1_OF_INT
private static int
BYTE_2_OF_INT
private static int
BYTE_3_OF_INT
private static int
BYTE_4_OF_INT
private static int
BYTE_MASK
private static long
INTEGER_MASK
private long
position
-
Constructor Summary
Constructors Constructor Description BitBuffer(java.nio.ByteBuffer writeBuffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
bitbuffer()
(package private) void
close()
int
missingBitsInCurrentByte()
void
movePosition(int i)
void
putByte(byte byteToAdd)
void
putByte(byte byteToAdd, int bits)
void
putInt(int i)
write out int value to the next 4 bytes of the buffervoid
putInt(int i, int bits)
void
putLong(long l, int bits)
-
-
-
Field Detail
-
BITS_OF_4_BYTES
private static final int BITS_OF_4_BYTES
- See Also:
- Constant Field Values
-
BYTE_MASK
private static final int BYTE_MASK
- See Also:
- Constant Field Values
-
INTEGER_MASK
private static final long INTEGER_MASK
- See Also:
- Constant Field Values
-
BITS_OF_1_BYTE
private static final int BITS_OF_1_BYTE
- See Also:
- Constant Field Values
-
BITS_OF_2_BYTES
private static final int BITS_OF_2_BYTES
- See Also:
- Constant Field Values
-
BITS_OF_3_BYTES
private static final int BITS_OF_3_BYTES
- See Also:
- Constant Field Values
-
BYTE_1_OF_INT
private static final int BYTE_1_OF_INT
- See Also:
- Constant Field Values
-
BYTE_2_OF_INT
private static final int BYTE_2_OF_INT
- See Also:
- Constant Field Values
-
BYTE_3_OF_INT
private static final int BYTE_3_OF_INT
- See Also:
- Constant Field Values
-
BYTE_4_OF_INT
private static final int BYTE_4_OF_INT
- See Also:
- Constant Field Values
-
buffer
private final java.nio.ByteBuffer buffer
-
position
private long position
-
-
Method Detail
-
bitbuffer
public int bitbuffer()
-
close
void close()
-
missingBitsInCurrentByte
public int missingBitsInCurrentByte()
-
movePosition
public void movePosition(int i)
-
putByte
public void putByte(byte byteToAdd)
-
putByte
public void putByte(byte byteToAdd, int bits)
-
putInt
public void putInt(int i)
write out int value to the next 4 bytes of the buffer- Parameters:
i
- integer to write
-
putInt
public void putInt(int i, int bits)
-
putLong
public void putLong(long l, int bits)
-
-