/*
* Copyright 2004-2019 H2 Group. Multiple-Licensed under the MPL 2.0,
* and the EPL 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2.compress;
Each data compression algorithm must implement this interface.
/**
* Each data compression algorithm must implement this interface.
*/
public interface Compressor {
No compression is used.
/**
* No compression is used.
*/
int NO = 0;
The LZF compression algorithm is used
/**
* The LZF compression algorithm is used
*/
int LZF = 1;
The DEFLATE compression algorithm is used.
/**
* The DEFLATE compression algorithm is used.
*/
int DEFLATE = 2;
Get the compression algorithm type.
Returns: the type
/**
* Get the compression algorithm type.
*
* @return the type
*/
int getAlgorithm();
Compress a number of bytes.
Params: - in – the input data
- inLen – the number of bytes to compress
- out – the output area
- outPos – the offset at the output array
Returns: the end position
/**
* Compress a number of bytes.
*
* @param in the input data
* @param inLen the number of bytes to compress
* @param out the output area
* @param outPos the offset at the output array
* @return the end position
*/
int compress(byte[] in, int inLen, byte[] out, int outPos);
Expand a number of compressed bytes.
Params: - 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
/**
* Expand a number of compressed bytes.
*
* @param in the compressed data
* @param inPos the offset at the input array
* @param inLen the number of bytes to read
* @param out the output area
* @param outPos the offset at the output array
* @param outLen the size of the uncompressed data
*/
void expand(byte[] in, int inPos, int inLen, byte[] out, int outPos,
int outLen);
Set the compression options. This may include settings for
higher performance but less compression.
Params: - options – the options
/**
* Set the compression options. This may include settings for
* higher performance but less compression.
*
* @param options the options
*/
void setOptions(String options);
}