Class BitStream
java.lang.Object
org.apache.commons.compress.utils.BitInputStream
org.apache.commons.compress.archivers.zip.BitStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Iterates over the bits of an InputStream. For each byte the bits
are read from the right to the left.
- Since:
- 1.7
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.commons.compress.utils.BitInputStream
alignWithByteBoundary, bitsAvailable, bitsCached, clearBitCache, close, getBytesRead, readBits
-
Constructor Details
-
BitStream
BitStream(InputStream in)
-
-
Method Details
-
nextBit
Returns the next bit.- Returns:
- The next bit (0 or 1) or -1 if the end of the stream has been reached
- Throws:
IOException
-
nextBits
Returns the integer value formed by the n next bits (up to 8 bits).- Parameters:
n
- the number of bits read (up to 8)- Returns:
- The value formed by the n bits, or -1 if the end of the stream has been reached
- Throws:
IOException
-
nextByte
- Throws:
IOException
-