com.lizardtech.djvu
Class BSInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.lizardtech.djvu.BSInputStream
All Implemented Interfaces:
DjVuInterface, java.io.Closeable

public final class BSInputStream
extends java.io.InputStream
implements DjVuInterface

This class decodes a bzz encoded InputStream.

Version:
$Revision: 1.3 $
Author:
$author$

Constructor Summary
BSInputStream()
          Creates a new BSInputStream object.
BSInputStream(java.io.InputStream input)
          Creates a new BSInputStream object.
 
Method Summary
static BSInputStream createBSInputStream(DjVuInterface ref)
          Creates an instance of BSInputStream with the options interherited from the specified reference.
 void flush()
          Clears any decoded data.
 DjVuOptions getDjVuOptions()
          Query the DjVuOptions used by this object.
 BSInputStream init(java.io.InputStream input)
          Called to initialize the stream and set the data to be decoded.
 int read()
          Called to read the next byte of data.
 int read(byte[] buffer, int offset, int sz)
          Called to read data into a buffer.
 void setDjVuOptions(DjVuOptions options)
          Set the DjVuOptions used by this object.
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BSInputStream

public BSInputStream()
Creates a new BSInputStream object.


BSInputStream

public BSInputStream(java.io.InputStream input)
              throws java.io.IOException
Creates a new BSInputStream object.

Parameters:
input - steam to decode
Throws:
java.io.IOException - if an error occures
Method Detail

setDjVuOptions

public void setDjVuOptions(DjVuOptions options)
Set the DjVuOptions used by this object.

Specified by:
setDjVuOptions in interface DjVuInterface
Parameters:
options - The DjVuOptions used by this object.

getDjVuOptions

public DjVuOptions getDjVuOptions()
Query the DjVuOptions used by this object.

Specified by:
getDjVuOptions in interface DjVuInterface
Returns:
the DjVuOptions used by this object.

createBSInputStream

public static BSInputStream createBSInputStream(DjVuInterface ref)
Creates an instance of BSInputStream with the options interherited from the specified reference.

Parameters:
ref - Object to interherit DjVuOptions from.
Returns:
a new instance of BSInputStream.

flush

public void flush()
Clears any decoded data.


init

public BSInputStream init(java.io.InputStream input)
                   throws java.io.IOException
Called to initialize the stream and set the data to be decoded.

Parameters:
input - stream to be decoded
Returns:
the initialized stream
Throws:
java.io.IOException - if an error occurs

read

public int read(byte[] buffer,
                int offset,
                int sz)
         throws java.io.IOException
Called to read data into a buffer.

Overrides:
read in class java.io.InputStream
Parameters:
buffer - byte array to fill with data
offset - to start adding data
sz - maximum amount of data to read
Returns:
the number of bytes read
Throws:
java.io.IOException - if an error occurs

read

public int read()
         throws java.io.IOException
Called to read the next byte of data.

Specified by:
read in class java.io.InputStream
Returns:
the next byte in a range 0 to 255 or -1 if an EOP has been read
Throws:
java.io.IOException - if an error occurs