All Packages Class Hierarchy This Package Previous Next Index
Class java.util.zip.Deflater
java.lang.Object
|
+----java.util.zip.Deflater
- public class Deflater
- extends Object
This class provides support for general purpose decompression using
the popular ZLIB compression library. The ZLIB compression library
was initially developed as part of the PNG graphics standard and is
not protected by patents. It is fully described in RFCs 1950, 1951,
and 1952, which can be found at
ftp://ds.internic.net/rfc in the files rfc1950.txt (zlib format),
rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
- See Also:
- Inflater
-
BEST_COMPRESSION
- Compression level for best compression.
-
BEST_SPEED
- Compression level for fastest compression.
-
DEFAULT_COMPRESSION
- Default compression level.
-
DEFAULT_STRATEGY
- Default compression strategy.
-
DEFLATED
- Compression method for the deflate algorithm (the only one currently
supported).
-
FILTERED
- Compression strategy best used for data consisting mostly of small
values with a somewhat random distribution.
-
HUFFMAN_ONLY
- Compression strategy for Huffman coding only.
-
NO_COMPRESSION
- Compression level for no compression.
-
Deflater()
- Creates a new compressor with the default compression level.
-
Deflater(int)
-
Creates a new compressor using the specified compression level.
-
Deflater(int, boolean)
- Creates a new compressor using the specified compression level.
-
deflate(byte[])
- Fills specified buffer with compressed data.
-
deflate(byte[], int, int)
- Fills specified buffer with compressed data.
-
end()
- Discards unprocessed input and frees internal data.
-
finalize()
- Frees the compressor when garbage is collected.
-
finish()
- When called, indicates that compression should end with the current
contents of the input buffer.
-
finished()
- Returns true if the end of the compressed data output stream has
been reached.
-
getAdler()
- Returns the ADLER-32 value of the uncompressed data.
-
getTotalIn()
- Returns the total number of bytes input so far.
-
getTotalOut()
- Returns the total number of bytes output so far.
-
needsInput()
- Returns true if the input data buffer is empty and setInput()
should be called in order to provide more input.
-
reset()
- Resets deflater so that a new set of input data can be processed.
-
setDictionary(byte[])
- Sets preset dictionary for compression.
-
setDictionary(byte[], int, int)
- Sets preset dictionary for compression.
-
setInput(byte[])
- Sets input data for compression.
-
setInput(byte[], int, int)
- Sets input data for compression.
-
setLevel(int)
- Sets the current compression level to the specified value.
-
setStrategy(int)
- Sets the compression strategy to the specified value.
DEFLATED
Properties Public Constant
DEFLATED=int
- Compression method for the deflate algorithm (the only one currently
supported).
NO_COMPRESSION
Properties Public Constant
NO_COMPRESSION=int
- Compression level for no compression.
BEST_SPEED
Properties Public Constant
BEST_SPEED=int
- Compression level for fastest compression.
BEST_COMPRESSION
Properties Public Constant
BEST_COMPRESSION=int
- Compression level for best compression.
DEFAULT_COMPRESSION
Properties Public Constant
DEFAULT_COMPRESSION=int
- Default compression level.
FILTERED
Properties Public Constant
FILTERED=int
- Compression strategy best used for data consisting mostly of small
values with a somewhat random distribution. Forces more Huffman coding
and less string matching.
HUFFMAN_ONLY
Properties Public Constant
HUFFMAN_ONLY=int
- Compression strategy for Huffman coding only.
DEFAULT_STRATEGY
Properties Public Constant
DEFAULT_STRATEGY=int
- Default compression strategy.
Deflater
method Deflater(level=int, -
nowrap=boolean) public
- Creates a new compressor using the specified compression level.
If 'nowrap' is true then the ZLIB header and checksum fields will
not be used in order to support the compression format used in
both GZIP and PKZIP.
- Parameters:
- level - the compression level (0-9)
- nowrap - if true then use GZIP compatible compression
Deflater
method Deflater(level=int) public
- Creates a new compressor using the specified compression level.
Compressed data will be generated in ZLIB format.
- Parameters:
- level - the compression level (0-9)
Deflater
method Deflater() public
- Creates a new compressor with the default compression level.
Compressed data will be generated in ZLIB format.
setInput
method setInput(b=byte[], -
off=int, -
len=int) public protect
- Sets input data for compression. This should be called whenever
needsInput() returns true indicating that more input data is required.
- Parameters:
- b - the input data bytes
- off - the start offset of the data
- len - the length of the data
- See Also:
- needsInput
setInput
method setInput(b=byte[]) public
- Sets input data for compression. This should be called whenever
needsInput() returns true indicating that more input data is required.
- Parameters:
- b - the input data bytes
- See Also:
- needsInput
setDictionary
method setDictionary(b=byte[], -
off=int, -
len=int) public protect
- Sets preset dictionary for compression. A preset dictionary is used
when the history buffer can be predetermined. When the data is later
uncompressed with Inflater.inflate(), Inflater.getAdler() can be called
in order to get the Adler-32 value of the dictionary required for
decompression.
- Parameters:
- b - the dictionary data bytes
- off - the start offset of the data
- len - the length of the data
- See Also:
- inflate, getAdler
setDictionary
method setDictionary(b=byte[]) public
- Sets preset dictionary for compression. A preset dictionary is used
when the history buffer can be predetermined. When the data is later
uncompressed with Inflater.inflate(), Inflater.getAdler() can be called
in order to get the Adler-32 value of the dictionary required for
decompression.
- Parameters:
- b - the dictionary data bytes
- See Also:
- inflate, getAdler
setStrategy
method setStrategy(strategy=int) public protect
- Sets the compression strategy to the specified value.
- Parameters:
- strategy - the new compression strategy
- Throws: IllegalArgumentException
- if the compression strategy is
invalid
setLevel
method setLevel(Level=int) public protect
- Sets the current compression level to the specified value.
- Parameters:
- level - the new compression level (0-9)
- Throws: IllegalArgumentException
- if the compression level is invalid
needsInput
method needsInput() returns boolean public
- Returns true if the input data buffer is empty and setInput()
should be called in order to provide more input.
finish
method finish() public protect
- When called, indicates that compression should end with the current
contents of the input buffer.
finished
method finished() returns boolean public protect
- Returns true if the end of the compressed data output stream has
been reached.
deflate
method deflate(b=byte[], -
off=int, -
len=int) returns int public protect
- Fills specified buffer with compressed data. Returns actual number
of bytes of compressed data. A return value of 0 indicates that
needsInput() should be called in order to determine if more input
data is required.
- Parameters:
- b - the buffer for the compressed data
- off - the start offset of the data
- len - the maximum number of bytes of compressed data
- Returns:
- the actual number of bytes of compressed data
deflate
method deflate(b=byte[]) returns int public
- Fills specified buffer with compressed data. Returns actual number
of bytes of compressed data. A return value of 0 indicates that
needsInput() should be called in order to determine if more input
data is required.
- Parameters:
- b - the buffer for the compressed data
- Returns:
- the actual number of bytes of compressed data
getAdler
method getAdler() returns int public protect
- Returns the ADLER-32 value of the uncompressed data.
getTotalIn
method getTotalIn() returns int public protect
- Returns the total number of bytes input so far.
getTotalOut
method getTotalOut() returns int public protect
- Returns the total number of bytes output so far.
reset
method reset() public protect
- Resets deflater so that a new set of input data can be processed.
Keeps current compression level and strategy settings.
end
method end() public protect
- Discards unprocessed input and frees internal data.
finalize
method finalize() Inheritable
- Frees the compressor when garbage is collected.
- Overrides:
- finalize in class Object
All Packages Class Hierarchy This Package Previous Next Index