|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttigase.util.ZLibWrapper
public class ZLibWrapper
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.
There are a few convenience methods allowing to directly compress String to ByteBuffer and other way around - from ByteBuffer to String decompression. For these methods data are assumed to be UTF-8 character String. Created: Jul 30, 2009 11:46:55 AM
Field Summary | |
---|---|
static int |
COMPRESSED_BUFF_SIZE
Field description |
static int |
DECOMPRESSED_BUFF_SIZE
Field description |
Constructor Summary | |
---|---|
ZLibWrapper()
Constructs ... |
|
ZLibWrapper(int level)
Constructs ... |
|
ZLibWrapper(int level,
int comp_buff_size)
Constructs ... |
Method Summary | |
---|---|
float |
averageCompressionRate()
Method description |
float |
averageDecompressionRate()
Method description |
java.nio.ByteBuffer |
compress(java.nio.ByteBuffer input)
|
java.nio.ByteBuffer |
compress(java.lang.String input)
Method description |
java.nio.ByteBuffer |
decompress(java.nio.ByteBuffer input)
Method description |
java.lang.String |
decompressToString(java.nio.ByteBuffer input)
Method description |
void |
end()
Method description |
float |
lastCompressionRate()
Method description |
float |
lastDecompressionRate()
Method description |
static void |
main(java.lang.String[] args)
Method description |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int COMPRESSED_BUFF_SIZE
public static final int DECOMPRESSED_BUFF_SIZE
Constructor Detail |
---|
public ZLibWrapper()
public ZLibWrapper(int level)
level
- public ZLibWrapper(int level, int comp_buff_size)
level
- comp_buff_size
- Method Detail |
---|
public static void main(java.lang.String[] args) throws java.lang.Exception
args
-
java.lang.Exception
public float averageCompressionRate()
public float averageDecompressionRate()
public java.nio.ByteBuffer compress(java.nio.ByteBuffer input)
input
-
public java.nio.ByteBuffer compress(java.lang.String input) throws java.nio.charset.CharacterCodingException
input
-
java.nio.charset.CharacterCodingException
public java.nio.ByteBuffer decompress(java.nio.ByteBuffer input)
input
-
public java.lang.String decompressToString(java.nio.ByteBuffer input) throws java.nio.charset.CharacterCodingException
input
-
java.nio.charset.CharacterCodingException
public void end()
public float lastCompressionRate()
public float lastDecompressionRate()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |