public class BitInputStream extends Object implements Closeable
| Constructor and Description |
|---|
BitInputStream(InputStream in,
ByteOrder byteOrder)
Constructor taking an InputStream and its bit arrangement.
|
| Modifier and Type | Method and Description |
|---|---|
void |
alignWithByteBoundary()
Drops bits until the next bits will be read from a byte boundary.
|
long |
bitsAvailable()
Returns an estimate of the number of bits that can be read from
this input stream without blocking by the next invocation of a
method for this input stream.
|
int |
bitsCached()
Returns the number of bits that can be read from this input
stream without reading from the underlying input stream at all.
|
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(InputStream in, 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 IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void clearBitCache()
readBits(int).public long readBits(int count) throws IOException
count - the number of bits to read, must be a positive
number not bigger than 63.IOException - on errorpublic int bitsCached()
public long bitsAvailable() throws IOException
IOException - if the underlying stream throws one when calling availablepublic void alignWithByteBoundary()
Copyright © 2018 The Apache Software Foundation. All rights reserved.