Elexis API documentation
Version 2.1.6 as of December 11 2011

ch.rgw.io
Class BitInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by ch.rgw.io.BitInputStream
All Implemented Interfaces:
java.io.Closeable

public class BitInputStream
extends java.io.InputStream

An InputStream for bitwise reading.

Author:
Gerry

Constructor Summary
BitInputStream(java.io.InputStream in)
           
 
Method Summary
 int available()
          Tells whether one or more bits can be read without blocking.
 void close()
           
 int pullBits(int bitnum)
          reads up to 32 bits and returns them as int.
 int read()
          reads a byte, starting not at byte boundaries, but at the last read bit.
 boolean readBit()
          reads a single bit
static java.lang.String Version()
           
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BitInputStream

public BitInputStream(java.io.InputStream in)
Method Detail

Version

public static final java.lang.String Version()

read

public int read()
         throws java.io.IOException
reads a byte, starting not at byte boundaries, but at the last read bit.

Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.read()

pullBits

public int pullBits(int bitnum)
             throws java.io.IOException
reads up to 32 bits and returns them as int.

Parameters:
bitnum - number of bits to read
Returns:
the integer containing the requested bits (left-padded with zero)
Throws:
java.io.IOException

readBit

public boolean readBit()
                throws java.io.IOException
reads a single bit

Returns:
true for an 1-Bit, false for a 0-Bit
Throws:
java.io.IOException

available

public int available()
              throws java.io.IOException
Tells whether one or more bits can be read without blocking. CAUTION: The returned number does not accurately indicate the number of waiting bits (Only zero or non-zero is guaranteed)

Overrides:
available in class java.io.InputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException

Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis