|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jarnbjo.util.io.ByteArrayBitInputStream
Implementation of the BitInputStream interface,
using a byte array as data source.
| Field Summary |
| Fields inherited from interface de.jarnbjo.util.io.BitInputStream |
BIG_ENDIAN, LITTLE_ENDIAN |
| Constructor Summary | |
ByteArrayBitInputStream(byte[] source)
|
|
ByteArrayBitInputStream(byte[] source,
int endian)
|
|
| Method Summary | |
void |
align()
causes the read pointer to be moved to the beginning of the next byte, remaining bits in the current byte are discarded |
boolean |
getBit()
reads one bit (as a boolean) from the input stream |
int |
getInt(HuffmanNode root)
reads a huffman codeword based on the root
parameter and returns the decoded value |
int |
getInt(int bits)
reads bits number of bits from the input
stream |
long |
getLong(int bits)
reads bits number of bits from the input
stream |
int |
getSignedInt(int bits)
reads bits number of bits from the input
stream |
byte[] |
getSource()
|
int |
readSignedRice(int order)
reads an integer encoded as "signed rice" as described in the FLAC audio format specification not supported for little endian |
void |
readSignedRice(int order,
int[] buffer,
int off,
int len)
fills the array from offset with len
integers encoded as "signed rice" as described in
the FLAC audio format specification
not supported for little endian |
void |
setEndian(int endian)
changes the endian mode used when reading bit-wise from the stream, changing the mode mid-stream will cause the read cursor to move to the beginning of the next byte (as if calling the allign method |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ByteArrayBitInputStream(byte[] source)
public ByteArrayBitInputStream(byte[] source,
int endian)
| Method Detail |
public boolean getBit()
throws java.io.IOException
BitInputStream
getBit in interface BitInputStreamtrue if the next bit is 1,
false otherwise
java.io.IOException - if an I/O error occurs
public int getInt(int bits)
throws java.io.IOException
BitInputStreambits number of bits from the input
stream
getInt in interface BitInputStreamjava.io.IOException - if an I/O error occurs
public int getSignedInt(int bits)
throws java.io.IOException
BitInputStreambits number of bits from the input
stream
getSignedInt in interface BitInputStreamjava.io.IOException - if an I/O error occurs
public int getInt(HuffmanNode root)
throws java.io.IOException
BitInputStreamroot
parameter and returns the decoded value
getInt in interface BitInputStreamroot - the root of the Huffman tree used to decode the codeword
java.io.IOException - if an I/O error occurs
public long getLong(int bits)
throws java.io.IOException
BitInputStreambits number of bits from the input
stream
getLong in interface BitInputStreamjava.io.IOException - if an I/O error occurs
public int readSignedRice(int order)
throws java.io.IOException
reads an integer encoded as "signed rice" as described in the FLAC audio format specification
not supported for little endian
readSignedRice in interface BitInputStreamorder -
java.io.IOException - if an I/O error occurs
java.lang.UnsupportedOperationException - if the method is not supported by the implementation
public void readSignedRice(int order,
int[] buffer,
int off,
int len)
throws java.io.IOException
fills the array from offset with len
integers encoded as "signed rice" as described in
the FLAC audio format specification
not supported for little endian
readSignedRice in interface BitInputStreamorder - buffer - len - off -
java.io.IOException - if an I/O error occurs
java.lang.UnsupportedOperationException - if the method is not supported by the implementationpublic void align()
BitInputStream
align in interface BitInputStreampublic void setEndian(int endian)
BitInputStreamallign method
setEndian in interface BitInputStreamBitInputStream.align()public byte[] getSource()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||