public class NonBlockingBitInputStream extends Object implements Closeable
NonBlockingBitInputStream allows reading individual bits from a
general Java InputStream. Like the various Stream-classes from Java, the
BitInputStream has to be created based on another Input stream. It provides a
function to read the next bit from the stream, as well as to read multiple
bits at once and write the resulting data into an integer value.BitInputStream| Constructor and Description |
|---|
NonBlockingBitInputStream(InputStream aIS,
ByteOrder aByteOrder)
Create a new bit input stream based on an existing Java InputStream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the underlying input stream.
|
ByteOrder |
getByteOrder() |
int |
readBit()
Read the next bit from the stream.
|
int |
readBits(int aNumberOfBits)
Read a specified number of bits and return them combined as an integer
value.
|
String |
toString() |
public NonBlockingBitInputStream(@Nonnull InputStream aIS, @Nonnull ByteOrder aByteOrder)
aIS - the input stream this class should read the bits from. May not be
null.aByteOrder - The non-null byte order to use.public int readBits(@Nonnegative int aNumberOfBits) throws IOException
aNumberOfBits - defines how many bits to read from the stream.IOException - In case EOF is reachedpublic int readBit()
throws IOException
IOException - In case EOF is reachedpublic void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2006–2014 phloc systems. All rights reserved.