org.apache.mina.filter.support
Class Zlib
java.lang.Object
org.apache.mina.filter.support.Zlib
public class Zlib
extends java.lang.Object
A helper class for interfacing with the JZlib library. This class acts both
as a compressor and decompressor, but only as one at a time. The only
flush method supported is Z_SYNC_FLUSH also known as Z_PARTIAL_FLUSH
Zlib(int compressionLevel, int mode)
|
COMPRESSION_DEFAULT
public static final int COMPRESSION_DEFAULT
COMPRESSION_MAX
public static final int COMPRESSION_MAX
COMPRESSION_MIN
public static final int COMPRESSION_MIN
COMPRESSION_NONE
public static final int COMPRESSION_NONE
MODE_DEFLATER
public static final int MODE_DEFLATER
MODE_INFLATER
public static final int MODE_INFLATER
Zlib
public Zlib(int compressionLevel,
int mode)
compressionLevel
- the level of compression that should be usedmode
- the mode in which the instance will operate. Can be either
of MODE_DEFLATER or MODE_INFLATER
cleanUp
public void cleanUp()
Cleans up the resources used by the compression library.
deflate
public ByteBuffer deflate(ByteBuffer inBuffer)
throws IOException
inBuffer
- the buffer to be compressed. The contents are transferred
into a local byte array and the buffer is flipped and returned intact.
- the buffer with the compressed data. If not passed to any of the
MINA methods that automatically release the buffer, the buffer has to be
released manually.
inflate
public ByteBuffer inflate(ByteBuffer inBuffer)
throws IOException
inBuffer
- the ByteBuffer
to be decompressed. The contents
of the buffer are transferred into a local byte array and the buffer is
flipped and returned intact.
- the decompressed data. If not passed to the MINA methods that
release the buffer automatically, the buffer has to be manually released