java.util.zip
public
class
java.util.zip.Inflater
The Inflater class is used to decompress bytes using the DEFLATE compression
algorithm. Inflation is performed by the ZLIB compression library.
Summary
Public Constructors
Public Methods
Protected Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Public Constructors
public
Inflater()
Constructs a new Inflater instance.
public
Inflater(boolean noHeader)
Constructs a new Inflater instance. If noHeader is true the Inflater will
not attempt to read a ZLIB header.
Parameters
noHeader
| If true, read a ZLIB header from input.
|
Public Methods
public
synchronized
void
end()
Release any resources associated with this Inflater. Any unused
input/output is discarded. This is also called by the finalize method.
public
synchronized
boolean
finished()
Indicates if the Inflater has inflated the entire deflated stream. If
deflated bytes remain and needsInput returns true this method will return
false. This method should be called after all deflated input is supplied
to the Inflater.
Returns
- True if all input has been inflated, false otherwise
public
synchronized
int
getAdler()
Returns the Adler32 checksum of either all bytes inflated, or the
checksum of the preset dictionary if one has been supplied.
Returns
- The Adler32 checksum associated with this Inflater.
public
synchronized
long
getBytesRead()
Returns a long int of total number of bytes of input read by the
Inflater.
This method performs the same as getTotalIn except it returns a
long value instead of an integer
public
synchronized
long
getBytesWritten()
Returns a long int of total number of bytes of input output by the
Inflater.
This method performs the same as getTotalOut except it returns a
long value instead of an integer
public
synchronized
int
getRemaining()
Returns the number of bytes of current input remaining to be read by the
inflater
Returns
- Number of bytes of unread input.
public
synchronized
int
getTotalIn()
Returns total number of bytes of input read by the Inflater.
public
synchronized
int
getTotalOut()
Returns total number of bytes of input output by the Inflater.
public
int
inflate(byte[] buf)
Inflates bytes from current input and stores them in buf.
Parameters
buf
| Buffer to output inflated bytes |
public
synchronized
int
inflate(byte[] buf, int off, int nbytes)
Inflates up to nbytes bytes from current input and stores them in buf
starting at off.
Parameters
buf
| Buffer to output inflated bytes |
off
| Offset in buffer into which to store inflated bytes |
nbytes
| Number of inflated bytes to store |
public
synchronized
boolean
needsDictionary()
Indicates whether the input bytes were compressed with a preset
dictionary. This method should be called prior to inflate() to determine
if a dictionary is required. If so setDictionary() should be called with
the appropriate dictionary prior to calling inflate().
Returns
- true if a preset dictionary is required for inflation.
public
synchronized
boolean
needsInput()
public
synchronized
void
reset()
Resets the Inflater.
public
synchronized
void
setDictionary(byte[] buf, int off, int nbytes)
public
synchronized
void
setDictionary(byte[] buf)
Sets the preset dictionary to be used for inflation to buf.
needsDictionary() can be called to determine whether the current input
was deflated using a preset dictionary.
Parameters
buf
| The buffer containing the dictionary bytes |
public
synchronized
void
setInput(byte[] buf, int off, int nbytes)
Sets the current input to the region of buf starting at off and ending at
nbytes - 1. This method should only be called if needsInput() returns
true.
Parameters
buf
| input buffer |
off
| offset to read from in buffer |
nbytes
| number of bytes to read |
public
synchronized
void
setInput(byte[] buf)
Sets the current input to buf. This method should only be called if
needsInput() returns true.
Protected Methods
protected
void
finalize()
Called by the virtual machine when there are no longer any (non-weak)
references to the receiver. Subclasses can use this facility to guarantee
that any associated resources are cleaned up before the receiver is
garbage collected. Uncaught exceptions which are thrown during the
running of the method cause it to terminate immediately, but are
otherwise ignored.
Note: The virtual machine assumes that the implementation in class Object
is empty.