| java.lang.Object jj2000.j2k.entropy.decoder.ByteToBitInput
ByteToBitInput | class ByteToBitInput (Code) | | This class provides an adapter to perform bit based input on byte based
output obejcts that inherit from a 'ByteInputBuffer' class. This class also
performs the bit unstuffing procedure specified for the 'selective
arithmetic coding bypass' mode of the JPEG 2000 entropy coder.
|
Constructor Summary | |
| ByteToBitInput(ByteInputBuffer in) Instantiates a new 'ByteToBitInput' object that uses 'in' as the
underlying byte based input. |
Method Summary | |
public boolean | checkBytePadding() Checks for past errors in the decoding process by verifying the byte
padding with an alternating sequence of 0's and 1's. | final void | flush() Flushes (i.e. | final int | readBit() Reads from the bit stream one bit. | final void | setByteArray(byte buf, int off, int len) Resets the underlying byte input to start a new segment. |
bbuf | int bbuf(Code) | | The bit buffer
|
bpos | int bpos(Code) | | The position of the next bit to get from the byte buffer. When it is
-1 the bit buffer is empty.
|
ByteToBitInput | ByteToBitInput(ByteInputBuffer in)(Code) | | Instantiates a new 'ByteToBitInput' object that uses 'in' as the
underlying byte based input.
Parameters: in - The underlying byte based input. |
checkBytePadding | public boolean checkBytePadding()(Code) | | Checks for past errors in the decoding process by verifying the byte
padding with an alternating sequence of 0's and 1's. If an error is
detected it means that the raw bit stream has been wrongly decoded or
that the raw terminated segment length is too long. If no errors are
detected it does not necessarily mean that the raw bit stream has been
correctly decoded.
True if errors are found, false otherwise. |
flush | final void flush()(Code) | | Flushes (i.e. empties) the bit buffer, without loading any new
bytes. This realigns the input at the next byte boundary, if not
already at one.
|
readBit | final int readBit()(Code) | | Reads from the bit stream one bit. If 'bpos' is -1 then a byte is read
and loaded into the bit buffer, from where the bit is read. If
necessary the bit unstuffing will be applied.
The read bit (0 or 1). |
setByteArray | final void setByteArray(byte buf, int off, int len)(Code) | | Resets the underlying byte input to start a new segment. The bit buffer
is flushed.
Parameters: buf - The byte array containing the byte data. If null thecurrent byte array is assumed. Parameters: off - The index of the first element in 'buf' to be decoded. Ifnegative the byte just after the previous segment is assumed, onlyvalid if 'buf' is null. Parameters: len - The number of bytes in 'buf' to be decoded. Any subsequentbytes are taken to be 0xFF. |
|
|