public class BZip2BitInputStream extends Object
An InputStream wrapper that allows the reading of single bit booleans, unary numbers, bit strings of arbitrary length (up to 24 bits), and bit aligned 32-bit integers. A single byte at a time is read from the wrapped stream when more bits are required
Constructor and Description |
---|
BZip2BitInputStream(InputStream inputStream) |
Modifier and Type | Method and Description |
---|---|
int |
readBits(int count)
Reads up to 24 bits from the wrapped input stream
|
boolean |
readBoolean()
Reads a single bit from the wrapped input stream
|
int |
readInteger()
Reads 32 bits of input as an integer
|
int |
readUnary()
Reads a zero-terminated unary number from the wrapped input stream
|
public BZip2BitInputStream(InputStream inputStream)
inputStream
- The InputStream to wrappublic boolean readBoolean() throws IOException
true
if the bit read was 1
, otherwise false
IOException
- if no more bits are available in the input streampublic int readUnary() throws IOException
IOException
- if no more bits are available in the input streampublic int readBits(int count) throws IOException
count
- The number of bits to read (maximum 24)IOException
- if more bits are requested than are available in the input streampublic int readInteger() throws IOException
IOException
- if 32 bits are not available in the input streamCopyright © 2016. All rights reserved.