Methods Summary |
---|
public synchronized void | end()Closes the decompressor and discards any unprocessed input.
This method should be called when the decompressor is no longer
being used, but will also be called automatically by the finalize()
method. Once this method is called, the behavior of the Inflater
object is undefined.
if (strm != 0) {
end(strm);
strm = 0;
}
|
private static native void | end(long strm)
|
private void | ensureOpen()
if (strm == 0)
throw new NullPointerException();
|
protected void | finalize()Closes the decompressor when garbage is collected.
end();
|
public synchronized boolean | finished()Returns true if the end of the compressed data stream has been
reached.
return finished;
|
public synchronized int | getAdler()Returns the ADLER-32 value of the uncompressed data.
ensureOpen();
return getAdler(strm);
|
private static native int | getAdler(long strm)
|
public synchronized long | getBytesRead()Returns the total number of compressed bytes input so far.
ensureOpen();
return getBytesRead(strm);
|
private static native long | getBytesRead(long strm)
|
public synchronized long | getBytesWritten()Returns the total number of uncompressed bytes output so far.
ensureOpen();
return getBytesWritten(strm);
|
private static native long | getBytesWritten(long strm)
|
public synchronized int | getRemaining()Returns the total number of bytes remaining in the input buffer.
This can be used to find out what bytes still remain in the input
buffer after decompression has finished.
return len;
|
public int | getTotalIn()Returns the total number of compressed bytes input so far.
Since the number of bytes may be greater than
Integer.MAX_VALUE, the {@link #getBytesRead()} method is now
the preferred means of obtaining this information.
return (int) getBytesRead();
|
public int | getTotalOut()Returns the total number of uncompressed bytes output so far.
Since the number of bytes may be greater than
Integer.MAX_VALUE, the {@link #getBytesWritten()} method is now
the preferred means of obtaining this information.
return (int) getBytesWritten();
|
public synchronized int | inflate(byte[] b, int off, int len)Uncompresses bytes into specified buffer. Returns actual number
of bytes uncompressed. A return value of 0 indicates that
needsInput() or needsDictionary() should be called in order to
determine if more input data or a preset dictionary is required.
In the later case, getAdler() can be used to get the Adler-32
value of the dictionary required.
if (b == null) {
throw new NullPointerException();
}
if (off < 0 || len < 0 || off > b.length - len) {
throw new ArrayIndexOutOfBoundsException();
}
return inflateBytes(b, off, len);
|
public int | inflate(byte[] b)Uncompresses bytes into specified buffer. Returns actual number
of bytes uncompressed. A return value of 0 indicates that
needsInput() or needsDictionary() should be called in order to
determine if more input data or a preset dictionary is required.
In the later case, getAdler() can be used to get the Adler-32
value of the dictionary required.
return inflate(b, 0, b.length);
|
private native int | inflateBytes(byte[] b, int off, int len)
|
private static native long | init(boolean nowrap)
|
private static native void | initIDs()
|
public synchronized boolean | needsDictionary()Returns true if a preset dictionary is needed for decompression.
return needDict;
|
public synchronized boolean | needsInput()Returns true if no data remains in the input buffer. This can
be used to determine if #setInput should be called in order
to provide more input.
return len <= 0;
|
public synchronized void | reset()Resets inflater so that a new set of input data can be processed.
ensureOpen();
reset(strm);
finished = false;
needDict = false;
off = len = 0;
|
private static native void | reset(long strm)
|
private static native void | setDictionary(long strm, byte[] b, int off, int len)
|
public synchronized void | setDictionary(byte[] b, int off, int len)Sets the preset dictionary to the given array of bytes. Should be
called when inflate() returns 0 and needsDictionary() returns true
indicating that a preset dictionary is required. The method getAdler()
can be used to get the Adler-32 value of the dictionary needed.
if (strm == 0 || b == null) {
throw new NullPointerException();
}
if (off < 0 || len < 0 || off > b.length - len) {
throw new ArrayIndexOutOfBoundsException();
}
setDictionary(strm, b, off, len);
needDict = false;
|
public void | setDictionary(byte[] b)Sets the preset dictionary to the given array of bytes. Should be
called when inflate() returns 0 and needsDictionary() returns true
indicating that a preset dictionary is required. The method getAdler()
can be used to get the Adler-32 value of the dictionary needed.
setDictionary(b, 0, b.length);
|
public synchronized void | setInput(byte[] b, int off, int len)Sets input data for decompression. Should be called whenever
needsInput() returns true indicating that more input data is
required.
if (b == null) {
throw new NullPointerException();
}
if (off < 0 || len < 0 || off > b.length - len) {
throw new ArrayIndexOutOfBoundsException();
}
this.buf = b;
this.off = off;
this.len = len;
|
public void | setInput(byte[] b)Sets input data for decompression. Should be called whenever
needsInput() returns true indicating that more input data is
required.
setInput(b, 0, b.length);
|