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

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

public class GZIPImageInputStream
extends InflaterImageInputStream

This class implements a stream filter for reading compressed data in the GZIP format.

Author:
Simone Giannecchini, GeoSolutions

Field Summary
protected  CRC32 crc
          CRC-32 for uncompressed data.
protected  boolean eos
          Indicates end of input stream.
static int GZIP_MAGIC
          GZIP header magic number.
 
Fields inherited from class InflaterImageInputStream
buf, inf, len, singleByteBuf, usesDefaultInflater
 
Fields inherited from class FilterImageInputStream
iis
 
Fields inherited from class ImageInputStreamImpl
bitOffset, byteOrder, flushedPos, streamPos
 
Constructor Summary
GZIPImageInputStream(ImageInputStream iis)
          Creates a new input stream with the specified buffer size.
 
Method Summary
 void close()
          Closes this input stream and releases any system resources associated with the stream.
 int read(byte[] buf, int off, int len)
          Reads uncompressed data into an array of bytes.
 
Methods inherited from class InflaterImageInputStream
fill, mark, read, reset, seek, skipBytes, skipBytes
 
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

GZIP_MAGIC

public static final int GZIP_MAGIC
GZIP header magic number.

See Also:
Constant Field Values

crc

protected CRC32 crc
CRC-32 for uncompressed data.


eos

protected boolean eos
Indicates end of input stream.

Constructor Detail

GZIPImageInputStream

public GZIPImageInputStream(ImageInputStream iis)
                     throws IOException
Creates a new input stream with the specified buffer size.

Parameters:
in - the input stream
size - the input buffer size
Throws:
IOException - if an I/O error has occurred
IllegalArgumentException - if size is <= 0
Method Detail

read

public int read(byte[] buf,
                int off,
                int len)
         throws IOException
Reads uncompressed data into an array of bytes. Blocks until enough input is available for decompression.

Specified by:
read in interface ImageInputStream
Overrides:
read in class InflaterImageInputStream
Parameters:
buf - 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 stream is reached
Throws:
IOException - if an I/O error has occurred or the compressed input data is corrupt

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 InflaterImageInputStream
Throws:
IOException - if an I/O error has occurred


Copyright © 2006-2010 GeoSolutions. All Rights Reserved.