public class BitInputStream
extends java.lang.Object
implements java.io.Closeable
Constructor and Description |
---|
BitInputStream(java.io.InputStream in,
java.nio.ByteOrder byteOrder)
Constructor taking an InputStream and its bit arrangement.
|
Modifier and Type | Method and Description |
---|---|
void |
clearBitCache()
Clears the cache of bits that have been read from the
underlying stream but not yet provided via
readBits(int) . |
void |
close() |
long |
readBits(int count)
Returns at most 63 bits read from the underlying stream.
|
public BitInputStream(java.io.InputStream in, java.nio.ByteOrder byteOrder)
in
- the InputStreambyteOrder
- the bit arrangement across byte boundaries,
either BIG_ENDIAN (aaaaabbb bb000000) or LITTLE_ENDIAN (bbbaaaaa 000000bb)public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public void clearBitCache()
readBits(int)
.public long readBits(int count) throws java.io.IOException
count
- the number of bits to read, must be a positive
number not bigger than 63.java.io.IOException
- on error