|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jj2000.j2k.codestream.reader.PktHeaderBitReader
This class provides a bit based reading facility from a byte based one, applying the bit unstuffing procedure as required by the packet headers.
Field Summary | |
(package private) java.io.ByteArrayInputStream |
bais
The byte array that is the source of data if the PktHeaderBitReader is instantiated with a buffer instead of a RandomAccessIO |
(package private) int |
bbuf
The current bit buffer |
(package private) int |
bpos
The position of the next bit to read in the bit buffer (0 means empty, 8 full) |
(package private) RandomAccessIO |
in
The byte based source of data |
(package private) int |
nextbbuf
The next bit buffer, if bit stuffing occurred (i.e. |
(package private) boolean |
usebais
Flag indicating whether the data should be read from the buffer |
Constructor Summary | |
(package private) |
PktHeaderBitReader(java.io.ByteArrayInputStream bais)
Instantiates a 'PktHeaderBitReader' that gets the byte data from the given source. |
(package private) |
PktHeaderBitReader(RandomAccessIO in)
Instantiates a 'PktHeaderBitReader' that gets the byte data from the given source. |
Method Summary | |
(package private) int |
readBit()
Reads a single bit from the input. |
(package private) int |
readBits(int n)
Reads a specified number of bits and returns them in a single integer. |
(package private) void |
setInput(java.io.ByteArrayInputStream bais)
Sets the underlying byte based input to the given object. |
(package private) void |
setInput(RandomAccessIO in)
Sets the underlying byte based input to the given object. |
(package private) void |
sync()
Synchronizes this object with the underlying byte based input. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
RandomAccessIO in
java.io.ByteArrayInputStream bais
boolean usebais
int bbuf
int bpos
int nextbbuf
Constructor Detail |
PktHeaderBitReader(RandomAccessIO in)
in
- The source of byte dataPktHeaderBitReader(java.io.ByteArrayInputStream bais)
bais
- The source of byte dataMethod Detail |
final int readBit() throws java.io.IOException
java.io.IOException
- If an I/O error occurred
java.io.EOFException
- If teh end of file has been reachedfinal int readBits(int n) throws java.io.IOException
n
- The number of bits to read
java.io.IOException
- If an I/O error occurred
java.io.EOFException
- If teh end of file has been reachedvoid sync()
This method should always be called when some data has been read directly from the underlying byte based input since the last call to 'readBits()' or 'readBit()' before a new call to any of those methods.
void setInput(RandomAccessIO in)
This method is equivalent to creating a new 'PktHeaderBitReader' object.
in
- The source of byte datavoid setInput(java.io.ByteArrayInputStream bais)
This method is equivalent to creating a new 'PktHeaderBitReader' object.
bais
- The source of byte data
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |