CompressTool

A tool to losslessly compress data, and expand the compressed data again.

Methods
static CompressTool getInstance()
Get a new instance.
static CompressTool getInstance()
Get a new instance. Each instance uses a separate buffer, so multiple instances can be used concurrently. However each instance alone is not multithreading safe.
Returns:
a new instance
byte[] compress(byte[] in, String algorithm)
Compressed the data using the specified algorithm.
byte[] compress(byte[] in, String algorithm)
Compressed the data using the specified algorithm. If no algorithm is supplied, LZF is used
Parameters:
in - the byte array with the original data
algorithm - the algorithm (LZF, DEFLATE)
Returns:
the compressed data
Throws:
SQLException - if a error occurs
byte[] expand(byte[] in)
Expands the compressed data.
byte[] expand(byte[] in)
Expands the compressed data.
Parameters:
in - the byte array with the compressed data
Returns:
the uncompressed data
Throws:
SQLException - if a error occurs