it.geosolutions.imageio.stream.input.compressed
Class InflaterImageInputStream

Object
  extended by ImageInputStreamImpl
      extended by FilterImageInputStream
          extended by InflaterImageInputStream
All Implemented Interfaces:
DataInput, ImageInputStream
Direct Known Subclasses:
GZIPImageInputStream

public class InflaterImageInputStream
extends FilterImageInputStream

Author:
Simone Giannecchini, GeoSolutions

Field Summary
protected  byte[] buf
          Input buffer for decompression.
protected  boolean closed
           
protected  Inflater inf
          Decompressor for this stream.
protected  int len
          Length of input buffer.
protected  byte[] singleByteBuf
           
protected  boolean usesDefaultInflater
           
 
Fields inherited from class FilterImageInputStream
iis
 
Fields inherited from class ImageInputStreamImpl
bitOffset, byteOrder, flushedPos, streamPos
 
Constructor Summary
InflaterImageInputStream(ImageInputStream iis)
           
InflaterImageInputStream(ImageInputStream iis, Inflater inflater)
           
InflaterImageInputStream(ImageInputStream iis, Inflater inflater, int size)
           
 
Method Summary
 void close()
          Closes this input stream and releases any system resources associated with the stream.
protected  void fill()
          Fills input buffer with more data to decompress.
 void mark()
           
 int read()
          Reads a byte of uncompressed data.
 int read(byte[] b, int off, int len)
          Reads uncompressed data into an array of bytes.
 void reset()
           
 void seek(long pos)
           
 int skipBytes(int n)
           
 long skipBytes(long n)
          Skips specified number of bytes of uncompressed data.
 
Methods inherited from class FilterImageInputStream
getByteOrder, isCached, isCachedFile, isCachedMemory, setBitOffset, setByteOrder
 
Methods inherited from class ImageInputStreamImpl
checkClosed, finalize, flush, flushBefore, getBitOffset, getFlushedPosition, getStreamPosition, length, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ImageInputStream
flush, flushBefore, getBitOffset, getFlushedPosition, getStreamPosition, length, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF
 

Field Detail

len

protected int len
Length of input buffer.


closed

protected boolean closed

buf

protected byte[] buf
Input buffer for decompression.


singleByteBuf

protected byte[] singleByteBuf

usesDefaultInflater

protected boolean usesDefaultInflater

inf

protected Inflater inf
Decompressor for this stream.

Constructor Detail

InflaterImageInputStream

public InflaterImageInputStream(ImageInputStream iis)

InflaterImageInputStream

public InflaterImageInputStream(ImageInputStream iis,
                                Inflater inflater)

InflaterImageInputStream

public InflaterImageInputStream(ImageInputStream iis,
                                Inflater inflater,
                                int size)
Method Detail

read

public int read()
         throws IOException
Reads a byte of uncompressed data. This method will block until enough input is available for decompression.

Specified by:
read in interface ImageInputStream
Specified by:
read in class ImageInputStreamImpl
Returns:
the byte read, or -1 if end of compressed input is reached
Throws:
IOException - if an I/O error has occurred

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Reads uncompressed data into an array of bytes. This method will block until some input can be decompressed.

Specified by:
read in interface ImageInputStream
Specified by:
read in class ImageInputStreamImpl
Parameters:
b - the buffer into which the data is read
off - the start offset of the data
len - the maximum number of bytes read
Returns:
the actual number of bytes read, or -1 if the end of the compressed input is reached or a preset dictionary is needed
Throws:
ZipException - if a ZIP format error has occurred
IOException - if an I/O error has occurred

fill

protected void fill()
             throws IOException
Fills input buffer with more data to decompress.

Throws:
IOException - if an I/O error has occurred

close

public void close()
           throws IOException
Closes this input stream and releases any system resources associated with the stream.

Specified by:
close in interface ImageInputStream
Overrides:
close in class ImageInputStreamImpl
Throws:
IOException - if an I/O error has occurred

mark

public void mark()
Specified by:
mark in interface ImageInputStream
Overrides:
mark in class ImageInputStreamImpl

reset

public void reset()
           throws IOException
Specified by:
reset in interface ImageInputStream
Overrides:
reset in class ImageInputStreamImpl
Throws:
IOException

seek

public void seek(long pos)
          throws IOException
Specified by:
seek in interface ImageInputStream
Overrides:
seek in class ImageInputStreamImpl
Throws:
IOException

skipBytes

public int skipBytes(int n)
              throws IOException
Specified by:
skipBytes in interface DataInput
Specified by:
skipBytes in interface ImageInputStream
Overrides:
skipBytes in class FilterImageInputStream
Throws:
IOException

skipBytes

public long skipBytes(long n)
               throws IOException
Skips specified number of bytes of uncompressed data.

Specified by:
skipBytes in interface ImageInputStream
Overrides:
skipBytes in class ImageInputStreamImpl
Parameters:
n - the number of bytes to skip
Returns:
the actual number of bytes skipped.
Throws:
IOException - if an I/O error has occurred
IllegalArgumentException - if n < 0


Copyright © 2006-2010 GeoSolutions. All Rights Reserved.