|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectBitReader
public class BitReader
A class that wraps any InputStream to support bitwise reads.
| Constructor Summary | |
|---|---|
BitReader(InputStream s)
Creates a new BitInStream instance that wraps the given InputStream. |
|
| Method Summary | |
|---|---|
void |
close()
Closes the underlying InputStream. |
static void |
main(String[] args)
Unit test on file test.txt presumed to have contents "Hello." |
boolean |
readBit()
Reads the next bit, returning true if 1, false if 0. |
int |
readBits(int n)
Reads the next n bits, and returns them as the least significant n bits of an int, with earliest read bit at high-end. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BitReader(InputStream s)
s - an underlying InputStream| Method Detail |
|---|
public void close()
throws IOException
IOException - if underlying InputStream throws such an exception
public boolean readBit()
throws IOException
IOException - if underlying InputStream throws such an exception
public int readBits(int n)
throws IOException
n - Number of bits (must be 0 <= n <= 32)
IOException - if underlying InputStrea throws such an exception
public static void main(String[] args)
throws IOException
args -
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||