org.apache.pdfbox.io
Class NBitInputStream

java.lang.Object
  extended by org.apache.pdfbox.io.NBitInputStream

public class NBitInputStream
extends Object

This is an n-bit input stream. This means that you can read chunks of data as any number of bits, not just 8 bits like the regular input stream. Just set the number of bits that you would like to read on each call. The default is 8.

Version:
$Revision: 1.4 $
Author:
Ben Litchfield

Constructor Summary
NBitInputStream(InputStream is)
          Constructor.
 
Method Summary
 int getBitsInChunk()
          Getter for property bitsToRead.
 long read()
          This will read the next n bits from the stream and return the unsigned value of those bits.
 void setBitsInChunk(int bitsInChunkValue)
          Setter for property bitsToRead.
 void unread(long data)
          This will unread some data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NBitInputStream

public NBitInputStream(InputStream is)
Constructor.

Parameters:
is - The input stream to read from.
Method Detail

unread

public void unread(long data)
This will unread some data.

Parameters:
data - The data to put back into the stream.

read

public long read()
          throws IOException
This will read the next n bits from the stream and return the unsigned value of those bits.

Returns:
The next n bits from the stream.
Throws:
IOException - If there is an error reading from the underlying stream.

getBitsInChunk

public int getBitsInChunk()
Getter for property bitsToRead.

Returns:
Value of property bitsToRead.

setBitsInChunk

public void setBitsInChunk(int bitsInChunkValue)
Setter for property bitsToRead.

Parameters:
bitsInChunkValue - New value of property bitsToRead.


Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.