com.jcraft.jzlib
Class JZlib

java.lang.Object
  extended by com.jcraft.jzlib.JZlib

public final class JZlib
extends Object

This static class holds all the constants used by the compression and decompression algorithms.

There is no point in creating instances of this class.

The constants here are in these groups:

compression level constants:
Z_NO_COMPRESSION, Z_BEST_SPEED, Z_BEST_COMPRESSION, Z_DEFAULT_COMPRESSION
compression strategy constants:
Z_FILTERED, Z_HUFFMAN_ONLY, Z_DEFAULT_STRATEGY.
flushing type constants:
Z_NO_FLUSH, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH.
return code constants:
Z_OK, Z_STREAM_END, Z_NEED_DICT, Z_ERRNO, Z_STREAM_ERROR, Z_DATA_ERROR, Z_MEM_ERROR, Z_BUF_ERROR, Z_VERSION_ERROR.

Additionally, the version() method provides the corresponding zlib version string.

The documentation is partly copied or paraphrased from the zlib manual.


Field Summary
static int Z_BEST_COMPRESSION
          Compression level constant for maximal compression, for use with ZStream.deflateInit(int).
static int Z_BEST_SPEED
          Compression level constant for best speed, for use with ZStream.deflateInit(int).
static int Z_BUF_ERROR
          Return code constant for deflate, inflate, deflateParams, inflateSync.
static int Z_DATA_ERROR
          Return code constant for deflateEnd, inflate, inflateSetDictionary, inflateSync.
static int Z_DEFAULT_COMPRESSION
          Compression level constant for default compression, for use with ZStream.deflateInit(int).
static int Z_DEFAULT_STRATEGY
          Compression strategy constant: default strategy.
static int Z_ERRNO
          Return code constant for errors outside of the compression library.
static int Z_FILTERED
          Compression strategy constant for filtered data.
static int Z_FINISH
          Flushing type constant: finish.
static int Z_FULL_FLUSH
          Flushing type constant: full flush.
static int Z_HUFFMAN_ONLY
          Compression strategy constant: use only Huffman encoding (no string match).
static int Z_MEM_ERROR
          Return code constant, not used by JZlib.
static int Z_NEED_DICT
          Return code constant for inflate: need dictionary.
static int Z_NO_COMPRESSION
          Compression level constant for no compression, for use with ZStream.deflateInit(int).
static int Z_NO_FLUSH
          Flushing type constant: no flush.
static int Z_OK
          Return code constant for inflate/deflate (and most other methods): Okay.
static int Z_PARTIAL_FLUSH
          Flushing type constant: partial flush.
static int Z_STREAM_END
          Return code constant for inflate/deflate: stream end.
static int Z_STREAM_ERROR
          Return code constant for deflateInit, deflate, deflateEnd, inflateInit, inflate, inflateEnd, deflateSetDictionary, deflateParams, inflateSetDictionary, inflateSync, This means the stream state is inconsistent, or the parameters are not valid (for the configuration methods).
static int Z_SYNC_FLUSH
          Flushing type constant: synchronizing flush.
static int Z_VERSION_ERROR
          Return code constant, not used by JZlib.
 
Constructor Summary
JZlib()
           
 
Method Summary
static String version()
          returns the zlib version number this library is derived from.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Z_NO_COMPRESSION

public static final int Z_NO_COMPRESSION
Compression level constant for no compression, for use with ZStream.deflateInit(int).

See Also:
Constant Field Values

Z_BEST_SPEED

public static final int Z_BEST_SPEED
Compression level constant for best speed, for use with ZStream.deflateInit(int).

See Also:
Constant Field Values

Z_BEST_COMPRESSION

public static final int Z_BEST_COMPRESSION
Compression level constant for maximal compression, for use with ZStream.deflateInit(int).

See Also:
Constant Field Values

Z_DEFAULT_COMPRESSION

public static final int Z_DEFAULT_COMPRESSION
Compression level constant for default compression, for use with ZStream.deflateInit(int).

See Also:
Constant Field Values

Z_FILTERED

public static final int Z_FILTERED
Compression strategy constant for filtered data. For use with ZStream.deflateParams(int, int). Filtered data consists mostly of small values with a somewhat random distribution.

See Also:
Constant Field Values

Z_HUFFMAN_ONLY

public static final int Z_HUFFMAN_ONLY
Compression strategy constant: use only Huffman encoding (no string match). For use with ZStream.deflateParams(int, int).

See Also:
Constant Field Values

Z_DEFAULT_STRATEGY

public static final int Z_DEFAULT_STRATEGY
Compression strategy constant: default strategy. For use with ZStream.deflateParams(int, int). Use this for normal data.

See Also:
Constant Field Values

Z_NO_FLUSH

public static final int Z_NO_FLUSH
Flushing type constant: no flush. For use with ZStream.deflate(int) and ZStream.inflate(int). This should be used normally for compression, since it allows the library to decide how much data to collect before compressing it, maximizing the compression. For decompression, this will produce as much output as the library deems appropriate.

See Also:
Constant Field Values

Z_PARTIAL_FLUSH

public static final int Z_PARTIAL_FLUSH
Flushing type constant: partial flush. For use with ZStream.deflate(int) and ZStream.inflate(int). For compression, this will flush all output to far to the output buffer, completing the block and following it with an empty block. The output is not necessarily aligned with a byte boundary, but the empty block makes sure that the data so far is included in full bytes in the output.

See Also:
Constant Field Values

Z_SYNC_FLUSH

public static final int Z_SYNC_FLUSH
Flushing type constant: synchronizing flush. For use with ZStream.deflate(int) and ZStream.inflate(int). For compression, this will flush all output so far to the output buffer and align it on a byte boundary, so everything which was input before can be consumed at the output side. It finishes the current block and adds an empty block. This should not be used to often, as it degrades compression for some algorithms. For decompression, this requests to flush as much output as possible to the output buffer.

See Also:
Constant Field Values

Z_FULL_FLUSH

public static final int Z_FULL_FLUSH
Flushing type constant: full flush. For use with ZStream.deflate(int) and ZStream.inflate(int). For compression, this flushes all output like Z_SYNC_FLUSH, and then resets the compression state, so decompression can restart from here (with inflateSync) if the data is damaged. Don't use this too often, as it seriously degrades performance.

See Also:
Constant Field Values

Z_FINISH

public static final int Z_FINISH
Flushing type constant: finish. For use with ZStream.deflate(int) and ZStream.inflate(int). For compression, this flushes all output and then finishes up the stream. If there is enough output space, then the stream must be either closed or reset. For decompression, this will make sure that the stream will be decompressed completely, returning Z_BUF_ERROR if there is not enough output space.

See Also:
Constant Field Values

Z_OK

public static final int Z_OK
Return code constant for inflate/deflate (and most other methods): Okay. This means there was some input processed or output produced. For configuration methods, this means that the call succeeded.

See Also:
Constant Field Values

Z_STREAM_END

public static final int Z_STREAM_END
Return code constant for inflate/deflate: stream end. For compression, this means that after giving Z_FINISH as the flush parameter, all input was processed and completely flushed to the output. For decompression, this means that the end of the compressed stream is reached and fully decompressed.

See Also:
Constant Field Values

Z_NEED_DICT

public static final int Z_NEED_DICT
Return code constant for inflate: need dictionary. This means that ZStream.inflateSetDictionary(byte[], int) should be called. The Adler32 checksum of the needed dictionary is in ZStream.adler.

See Also:
Constant Field Values

Z_ERRNO

public static final int Z_ERRNO
Return code constant for errors outside of the compression library. This inheritance from zlib seems not to be used by JZlib. (It means "see the errno global variable for information about the error".)

See Also:
Constant Field Values

Z_STREAM_ERROR

public static final int Z_STREAM_ERROR
Return code constant for deflateInit, deflate, deflateEnd, inflateInit, inflate, inflateEnd, deflateSetDictionary, deflateParams, inflateSetDictionary, inflateSync, This means the stream state is inconsistent, or the parameters are not valid (for the configuration methods).

See Also:
Constant Field Values

Z_DATA_ERROR

public static final int Z_DATA_ERROR
Return code constant for deflateEnd, inflate, inflateSetDictionary, inflateSync. This means that the compressed data doesn't conform to the format, the dictionary has not the right checksum, or similar.

See Also:
Constant Field Values

Z_MEM_ERROR

public static final int Z_MEM_ERROR
Return code constant, not used by JZlib. In zlib this was returned if some memory allocation did not succeed. In Java this would give an OutOfMemoryError instead.

See Also:
Constant Field Values

Z_BUF_ERROR

public static final int Z_BUF_ERROR
Return code constant for deflate, inflate, deflateParams, inflateSync. This means that no progress could be made because there is either no free output space or no unused input (and such is needed).

See Also:
Constant Field Values

Z_VERSION_ERROR

public static final int Z_VERSION_ERROR
Return code constant, not used by JZlib. In zlib this is returned by inflateInit or deflateInit if the library detects some version incompatibility. This is not really possible in Java because of the separate compilation.

See Also:
Constant Field Values
Constructor Detail

JZlib

public JZlib()
Method Detail

version

public static String version()
returns the zlib version number this library is derived from.



This is an inofficial Javadoc created by PaĆ­lo Ebermann. Have a look at the official homepage.