|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream org.freehep.util.io.DecompressableInputStream org.freehep.util.io.BitInputStream
public class BitInputStream
Class to read bits from a Stream, allowing for byte synchronization. Signed, Unsigned, Booleans and Floats can be read.
Field Summary | |
---|---|
protected static int[] |
BIT_MASK
|
protected static int[] |
FIELD_MASK
|
protected static int |
MASK_SIZE
|
protected static int |
ONES
|
protected static int |
ZERO
|
Constructor Summary | |
---|---|
BitInputStream(InputStream in)
Create a Bit input stream from viven input |
Method Summary | |
---|---|
void |
byteAlign()
A utility to force the next read to be byte-aligned. |
protected void |
fetchByte()
A utility method to fetch the next byte in preparation for constructing a bit field. |
boolean |
readBitFlag()
Read a bit from the input stream and interpret this as a boolean value. |
float |
readFBits(int n)
Read a float value of n-bits from the stream. |
long |
readSBits(int n)
Read a signed value of n-bits from the input stream. |
long |
readUBits(int n)
Read an unsigned value of n-bits from the input stream. |
Methods inherited from class org.freehep.util.io.DecompressableInputStream |
---|
read, skip, startDecompressing |
Methods inherited from class java.io.InputStream |
---|
available, close, mark, markSupported, read, read, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int MASK_SIZE
protected static final int ZERO
protected static final int ONES
protected static final int[] BIT_MASK
protected static final int[] FIELD_MASK
Constructor Detail |
---|
public BitInputStream(InputStream in)
in
- stream to read fromMethod Detail |
---|
protected void fetchByte() throws IOException
IOException
- if read failspublic void byteAlign()
public boolean readBitFlag() throws IOException
IOException
- if read failspublic long readSBits(int n) throws IOException
n
- number of bits to read
IOException
- if read failspublic float readFBits(int n) throws IOException
n
- number of bits to read
IOException
- if read failspublic long readUBits(int n) throws IOException
n
- number of bits to read
IOException
- if read fails
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |