org.tentackle.util
Class CompressedInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by org.tentackle.util.CompressedInputStream
All Implemented Interfaces:
Closeable

public class CompressedInputStream
extends FilterInputStream

Stream to read compressed data from the underlying input stream.
Counterpart to CompressedOutputStream.


Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
CompressedInputStream(InputStream in)
          Creates a new compressed input stream.
The buffersize adapts dynamically to the packet size.
 
Method Summary
 void close()
          Closes this input stream and releases any system resources associated with the stream.
 boolean isClosed()
          Returns the closed state.
 int read()
          Reads the next uncompressed byte of data from the input stream.
 int read(byte[] b, int off, int len)
          Reads up to len uncompressed bytes of data from this input stream into an array of bytes.
 
Methods inherited from class java.io.FilterInputStream
available, 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

CompressedInputStream

public CompressedInputStream(InputStream in)
Creates a new compressed input stream.
The buffersize adapts dynamically to the packet size.

Parameters:
in - the underlying input stream
Method Detail

close

public void close()
           throws IOException
Description copied from class: java.io.FilterInputStream
Closes this input stream and releases any system resources associated with the stream. This method simply performs in.close().

Specified by:
close in interface Closeable
Overrides:
close in class FilterInputStream
Throws:
IOException - if an I/O error occurs.
See Also:
FilterInputStream.in

isClosed

public boolean isClosed()
Returns the closed state.

Returns:
true if closed

read

public int read()
         throws IOException
Reads the next uncompressed byte of data from the input stream.

Overrides:
read in class FilterInputStream
Returns:
the next byte of data, or -1 if the end of the stream is reached.
Throws:
IOException - if an I/O error occurs.
See Also:
FilterInputStream.in

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Reads up to len uncompressed bytes of data from this input stream into an array of bytes.

Overrides:
read in class FilterInputStream
Parameters:
b - the buffer into which the data is read.
off - the start offset in the destination array b
len - the maximum number of bytes read.
Returns:
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Throws:
IOException - if an I/O error occurs.
See Also:
FilterInputStream.in


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de