public class ZLibWrapper extends Object
This is a warpper for java.util.zip package and Deflater/Inflater classes specifically. This implementation allows for easy interaction between Deflater/Inflater and java.nio API which operates on ByteBuffer data. It also does some tricky stuff to flush Deflater without reseting it and allow a better compression ration on the data.
Modifier and Type | Field and Description |
---|---|
static int |
COMPRESSED_BUFF_SIZE |
static int |
DECOMPRESSED_BUFF_SIZE |
Constructor and Description |
---|
ZLibWrapper() |
ZLibWrapper(int level) |
ZLibWrapper(int level,
int comp_buff_size) |
Modifier and Type | Method and Description |
---|---|
float |
averageCompressionRate() |
float |
averageDecompressionRate() |
ByteBuffer |
compress(ByteBuffer input) |
ByteBuffer |
compress(String input) |
ByteBuffer |
decompress(ByteBuffer input) |
String |
decompressToString(ByteBuffer input) |
void |
end() |
float |
lastCompressionRate() |
float |
lastDecompressionRate() |
static void |
main(String[] args) |
void |
setIOListener(IOListener listener) |
public static final int COMPRESSED_BUFF_SIZE
public static final int DECOMPRESSED_BUFF_SIZE
public ZLibWrapper()
public ZLibWrapper(int level)
public ZLibWrapper(int level, int comp_buff_size)
public float averageCompressionRate()
public float averageDecompressionRate()
public ByteBuffer compress(ByteBuffer input)
public ByteBuffer compress(String input) throws CharacterCodingException
CharacterCodingException
public ByteBuffer decompress(ByteBuffer input) throws IOException
IOException
public String decompressToString(ByteBuffer input) throws CharacterCodingException, IOException
CharacterCodingException
IOException
public void end()
public float lastCompressionRate()
public float lastDecompressionRate()
public void setIOListener(IOListener listener)
Copyright © 2004–2019 "Tigase, Inc.". All rights reserved.