java.util.zip.Inflater
java.lang.Object
None
None
New as of JDK 1.1
The Inflater class provides support for general-purpose data decompression. The class uses the ZLIB compression algorithms described in RFC 1950, RFC 1951, and RFC 1952. These documents can be found at:
The Deflater class compresses data that can be uncompressed using Inflater.
The InflaterInputStream uses an internal Inflater to decompress data. Typically, you do not need to create a Inflater; instead, you can just use an instance of one of the subclasses of InflaterInputStream: GZIPInputStream or ZipInputStream.
public class java.util.zip.Inflater extends java.lang.Object { // Constructors public Inflater(); public Inflater(boolean nowrap); // Public Instance Methods public synchronized native void end(); public synchronized boolean finished(); public synchronized native int getAdler(); public synchronized int getRemaining(); public synchronized native int getTotalIn(); public synchronized native int getTotalOut(); public int inflate(byte[] b); public synchronized native int inflate(byte[] b, int off, int len); public synchronized boolean needsDictionary(); public synchronized boolean needsInput(); public synchronized native void reset(); public void setDictionary(byte[] b); public synchronized native void setDictionary(byte[] b, int off, int len); public void setInput(byte[] b); public synchronized void setInput(byte[] b, int off, int len); // Protected Instance Methods protected void finalize(); }
This constructor creates an Inflater that decompresses data in the ZLIB format.
A boolean value that specifies whether or not the ZLIB header and checksum data are expected in the compressed data.
This constructor creates an Inflater that decompresses data. If nowrap is true, the ZLIB header and checksum fields are not expected, which means that the compressed data is in the format used by GZIP and PKZIP. If the parameter is false, the data is decompressed in the ZLIB format.
This method discards any unprocessed input data and frees up internal buffers.
A boolean value that indicates whether or not the end of the compressed data has been reached.
This method returns true if the last of the compressed data has been read using inflate(). Otherwise it returns false.
The Adler32 checksum value of the uncompressed data.
This method returns an Adler32 checksum value that is calculated from the uncompressed data returned by inflate().
The number of bytes remaining in the input buffer.
This method returns the number of bytes that are in the input buffer. It can be called to find out how much data remains after a call to inflate().
The total number of bytes that have been input so far.
This method returns the number of bytes that have been passed to setInput() since this Inflater was created or since reset() was last called.
The total number of bytes that have been output so far.
This method returns the number of bytes that have been read from inflate() since this Inflater was created or since reset() was last called.
A byte array to be filled.
The number of decompressed bytes actually written to the array or 0 if more data may be required.
If the data in the input buffer is not in the correct format.
This method decompresses the data passed to setInput() and fills the given array with decompressed data. If this method returns 0, needsInput() and needsDictionary() should be called in order to determine whether the Inflater needs more data in its input buffer or whether it needs a preset dictionary.
public synchronized native int inflate(byte[] b, int off, int len) throws DataFormatException
A byte array to be filled.
An offset into the byte array.
The number of bytes to fill.
The number of decompressed bytes written to the array or 0 if more data may be required.
If the data in the input buffer is not in the correct format.
This method decompresses the data passed to setInput() and writes len bytes of the decompressed data into the given array, starting at off. If this method returns 0, needsInput() and needsDictionary() should be called in order to determine whether the Inflater needs more data in its input buffer or whether it needs a preset dictionary.
A boolean value that indicates whether or not a preset dictionary is needed.
This method returns true if a preset dictionary is needed for decompression. Otherwise it returns false.
A boolean value that indicates whether or not the input buffer is empty.
This method returns true if the input buffer is empty. Otherwise it returns false.
This method resets the Inflater to the state it was in when it was created, which means that a new set of data can be decompressed.
An array of byte values.
This method sets the preset dictionary for decompression using the data in the given array.
public synchronized native void setDictionary(byte[] b, int off, int len)
An array of byte values.
An offset into the byte array.
The number of bytes to use.
This method sets the preset dictionary for decompression using len bytes from the given array, starting from off.
An array of byte values.
This method places the contents of the given array into the input buffer of this Inflater.
An array of byte values.
An offset into the byte array.
The number of bytes to use.
This method places len bytes from the given array, starting at off, into the input buffer of this Inflater. Use the inflate() method to decompress the data and retrieve it in decompressed form.
Object.finalize()
This method calls end() when this Inflater is garbage collected.
Method |
Inherited From |
Method |
Inherited From |
---|---|---|---|
clone() |
Object |
equals(Object) |
Object |
getClass() |
Object |
hashCode() |
Object |
notify() |
Object |
notifyAll() |
Object |
toString() |
Object |
wait() |
Object |
wait(long) |
Object |
wait(long, int) |
Object |
Deflater, GZIPInputStream, InflaterInputStream, ZipInputStream