org.h2.compress
Interface Compressor

All Known Implementing Classes:
CompressDeflate, CompressLZF, CompressNo

public interface Compressor

Each data compression algorithm must implement this interface.


Field Summary
static int DEFLATE
          The DEFLATE compression algorithm is used.
static int LZF
          The LZF compression algorithm is used
static int NO
          No compression is used.
 
Method Summary
 int compress(byte[] in, int inLen, byte[] out, int outPos)
          Compress a number of bytes.
 void expand(byte[] in, int inPos, int inLen, byte[] out, int outPos, int outLen)
          Expand a number of compressed bytes.
 int getAlgorithm()
          Get the compression algorithm type.
 void setOptions(java.lang.String options)
          Set the compression options.
 

Field Detail

NO

static final int NO
No compression is used.

See Also:
Constant Field Values

LZF

static final int LZF
The LZF compression algorithm is used

See Also:
Constant Field Values

DEFLATE

static final int DEFLATE
The DEFLATE compression algorithm is used.

See Also:
Constant Field Values
Method Detail

getAlgorithm

int getAlgorithm()
Get the compression algorithm type.

Returns:
the type

compress

int compress(byte[] in,
             int inLen,
             byte[] out,
             int outPos)
Compress a number of bytes.

Parameters:
in - the input data
inLen - the number of bytes to compress
out - the output area
outPos - the offset at the output array
Returns:
the size of the compressed data

expand

void expand(byte[] in,
            int inPos,
            int inLen,
            byte[] out,
            int outPos,
            int outLen)
            throws java.sql.SQLException
Expand a number of compressed bytes.

Parameters:
in - the compressed data
inPos - the offset at the input array
inLen - the number of bytes to read
out - the output area
outPos - the offset at the output array
outLen - the size of the uncompressed data
Throws:
java.sql.SQLException

setOptions

void setOptions(java.lang.String options)
                throws java.sql.SQLException
Set the compression options. This may include settings for higher performance but less compression.

Parameters:
options - the options
Throws:
java.sql.SQLException