java.lang.Object | |
↳ | java.util.zip.Inflater |
This class uncompresses data that was compressed using the DEFLATE algorithm (see specification).
Basically this class is part of the API to the stream based ZLIB compression
library and is used as such by InflaterInputStream
and its
descendants.
The typical usage of a Inflater
outside this package consists of a
specific call to one of its constructors before being passed to an instance
of InflaterInputStream
.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This constructor creates an inflater that expects a header from the input
stream.
| |||||||||||
This constructor allows to create an inflater that expects no header from
the input stream.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Release any resources associated with this
Inflater . | |||||||||||
Indicates if the
Inflater has inflated the entire deflated
stream. | |||||||||||
Returns the Adler32 checksum of either all bytes inflated, or the
checksum of the preset dictionary if one has been supplied.
| |||||||||||
Returns the total number of bytes read by the
Inflater . | |||||||||||
Returns a the total number of bytes read by the
Inflater . | |||||||||||
Returns the number of bytes of current input remaining to be read by the
inflater.
| |||||||||||
Returns total number of bytes of input read by the
Inflater . | |||||||||||
Returns total number of bytes written to the output buffer by the
Inflater . | |||||||||||
Inflates up to n bytes from the current input and stores them in
buf starting at off . | |||||||||||
Inflates bytes from current input and stores them in
buf . | |||||||||||
Indicates whether the input bytes were compressed with a preset
dictionary.
| |||||||||||
Indicates that input has to be passed to the inflater.
| |||||||||||
Resets the
Inflater . | |||||||||||
Like
setDictionary(byte[]) , allowing to define a specific region
inside buf to be used as a dictionary. | |||||||||||
Sets the preset dictionary to be used for inflation to
buf . | |||||||||||
Sets the current input to the region of the input buffer starting at
off and ending at nbytes - 1 where data is written after
decompression. | |||||||||||
Sets the current input to to be decrompressed.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Called before the object's memory is reclaimed by the VM.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
This constructor creates an inflater that expects a header from the input
stream. Use Inflater(boolean)
if the input comes without a ZLIB
header.
This constructor allows to create an inflater that expects no header from the input stream.
noHeader | true indicates that no ZLIB header comes with the
input.
|
---|
Release any resources associated with this Inflater
. Any unused
input/output is discarded. This is also called by the finalize method.
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
.
true
if all input has been inflated, false
otherwise.
Returns the Adler32 checksum of either all bytes inflated, or the checksum of the preset dictionary if one has been supplied.
Inflater
.
Returns the total number of bytes read by the Inflater
. This
method performs the same as getTotalIn()
except that it returns a
long
value instead of an integer.
Returns a the total number of bytes read by the Inflater
. This
method performs the same as getTotalOut
except it returns a
long
value instead of an integer.
Returns the number of bytes of current input remaining to be read by the inflater.
Returns total number of bytes of input read by the Inflater
. The
result value is limited by Integer.MAX_VALUE
.
Returns total number of bytes written to the output buffer by the Inflater
. The result value is limited by Integer.MAX_VALUE
.
Inflates up to n bytes from the current input and stores them in buf
starting at off
.
buf | the buffer to write inflated bytes to. |
---|---|
off | the offset in buffer where to start writing decompressed data. |
nbytes | the number of inflated bytes to write to buf . |
DataFormatException | if the underlying stream is corrupted or was not compressed
using a Deflater . |
---|
Inflates bytes from current input and stores them in buf
.
buf | the buffer where decompressed data bytes are written. |
---|
DataFormatException | if the underlying stream is corrupted or was not compressed
using a Deflater .
|
---|
Indicates whether the input bytes were compressed with a preset
dictionary. This method should be called prior to inflate()
to
determine whether a dictionary is required. If so setDictionary()
should be called with the appropriate dictionary prior to calling inflate()
.
true
if a preset dictionary is required for inflation.Indicates that input has to be passed to the inflater.
true
if setInput
has to be called before
inflation can proceed.Resets the Inflater
. Should be called prior to inflating a new
set of data.
Like setDictionary(byte[])
, allowing to define a specific region
inside buf
to be used as a dictionary.
The dictionary should be set if the inflate(byte[])
returned
zero bytes inflated and needsDictionary()
returns
true
.
buf | the buffer containing the dictionary data bytes. |
---|---|
off | the offset of the data. |
nbytes | the length of the data. |
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.
buf | The buffer containing the dictionary bytes. |
---|
Sets the current input to the region of the input buffer starting at
off
and ending at nbytes - 1
where data is written after
decompression. This method should only be called if needsInput()
returns true
.
buf | the input buffer. |
---|---|
off | the offset to read from the input buffer. |
nbytes | the number of bytes to read. |
Sets the current input to to be decrompressed. This method should only be
called if needsInput()
returns true
.
buf | the input buffer. |
---|
Called before the object's memory is reclaimed by the VM. This can only happen once the garbage collector has detected that the object is no longer reachable by any thread of the running application.
The method can be used to free system resources or perform other cleanup
before the object is garbage collected. The default implementation of the
method is empty, which is also expected by the VM, but subclasses can
override finalize()
as required. Uncaught exceptions which are
thrown during the execution of this method cause it to terminate
immediately but are otherwise ignored.
Note that the VM does guarantee that finalize()
is called at most
once for any object, but it doesn't guarantee when (if at all) finalize()
will be called. For example, object B's finalize()
can delay the execution of object A's finalize()
method and
therefore it can delay the reclamation of A's memory. To be safe, use a
ReferenceQueue
, because it provides more control
over the way the VM deals with references during garbage collection.