public class Zlib
extends java.lang.Object
限定符和类型 | 字段和说明 |
---|---|
static int |
COMPRESSION_DEFAULT |
static int |
COMPRESSION_MAX |
static int |
COMPRESSION_MIN |
static int |
COMPRESSION_NONE |
static int |
MODE_DEFLATER |
static int |
MODE_INFLATER |
构造器和说明 |
---|
Zlib(int compressionLevel,
int mode) |
限定符和类型 | 方法和说明 |
---|---|
void |
cleanUp()
Cleans up the resources used by the compression library.
|
ByteBuffer |
deflate(ByteBuffer inBuffer) |
ByteBuffer |
inflate(ByteBuffer inBuffer) |
public static final int COMPRESSION_MAX
public static final int COMPRESSION_MIN
public static final int COMPRESSION_NONE
public static final int COMPRESSION_DEFAULT
public static final int MODE_DEFLATER
public static final int MODE_INFLATER
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_INFLATERpublic ByteBuffer inflate(ByteBuffer inBuffer) throws java.io.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.java.io.IOException
- if the decompression of the data failed for some reason.public ByteBuffer deflate(ByteBuffer inBuffer) throws java.io.IOException
inBuffer
- the buffer to be compressed. The contents are transferred
into a local byte array and the buffer is flipped and returned intact.java.io.IOException
- if the compression of teh buffer failed for some reasonpublic void cleanUp()