Package 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
-
-
Field Summary
Fields Modifier and Type Field Description static int
COMPRESSION_DEFAULT
static int
COMPRESSION_MAX
static int
COMPRESSION_MIN
static int
COMPRESSION_NONE
static int
MODE_DEFLATER
static int
MODE_INFLATER
-
Constructor Summary
Constructors Constructor Description Zlib(int compressionLevel, int mode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanUp()
Cleans up the resources used by the compression library.org.apache.mina.common.ByteBuffer
deflate(org.apache.mina.common.ByteBuffer inBuffer)
org.apache.mina.common.ByteBuffer
inflate(org.apache.mina.common.ByteBuffer inBuffer)
-
-
-
Field Detail
-
COMPRESSION_MAX
public static final int COMPRESSION_MAX
- See Also:
- Constant Field Values
-
COMPRESSION_MIN
public static final int COMPRESSION_MIN
- See Also:
- Constant Field Values
-
COMPRESSION_NONE
public static final int COMPRESSION_NONE
- See Also:
- Constant Field Values
-
COMPRESSION_DEFAULT
public static final int COMPRESSION_DEFAULT
- See Also:
- Constant Field Values
-
MODE_DEFLATER
public static final int MODE_DEFLATER
- See Also:
- Constant Field Values
-
MODE_INFLATER
public static final int MODE_INFLATER
- See Also:
- Constant Field Values
-
-
Method Detail
-
inflate
public org.apache.mina.common.ByteBuffer inflate(org.apache.mina.common.ByteBuffer inBuffer) throws java.io.IOException
- Parameters:
inBuffer
- theByteBuffer
to be decompressed. The contents of the buffer are transferred into a local byte array and the buffer is flipped and returned intact.- Returns:
- the decompressed data. If not passed to the MINA methods that release the buffer automatically, the buffer has to be manually released
- Throws:
java.io.IOException
- if the decompression of the data failed for some reason.
-
deflate
public org.apache.mina.common.ByteBuffer deflate(org.apache.mina.common.ByteBuffer inBuffer) throws java.io.IOException
- Parameters:
inBuffer
- the buffer to be compressed. The contents are transferred into a local byte array and the buffer is flipped and returned intact.- Returns:
- 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.
- Throws:
java.io.IOException
- if the compression of teh buffer failed for some reason
-
cleanUp
public void cleanUp()
Cleans up the resources used by the compression library.
-
-