Debian Codegraph @

src/main/org/h2/compress/Compressor.java

raw
1 /*
2 * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,
3 * and the EPL 1.0 (https://h2database.com/html/license.html).
4 * Initial Developer: H2 Group
5 */
6 package org.h2.compress;
7
8
9 /**
10 * Each data compression algorithm must implement this interface.
11 */
12 public interface Compressor {
13
14 /**
15 * No compression is used.
16 */
17 int NO = 0;
18
19 /**
20 * The LZF compression algorithm is used
21 */
22 int LZF = 1;
23
24 /**
25 * The DEFLATE compression algorithm is used.
26 */
27 int DEFLATE = 2;
28
29 /**
30 * Get the compression algorithm type.
31 *
32 * @return the type
33 */
34 int getAlgorithm();
35
36 /**
37 * Compress a number of bytes.
38 *
39 * @param in the input data
40 * @param inPos the offset at the input array
41 * @param inLen the number of bytes to compress
42 * @param out the output area
43 * @param outPos the offset at the output array
44 * @return the end position
45 */
46 int compress(byte[] in, int inPos, int inLen, byte[] out, int outPos);
47
48 /**
49 * Expand a number of compressed bytes.
50 *
51 * @param in the compressed data
52 * @param inPos the offset at the input array
53 * @param inLen the number of bytes to read
54 * @param out the output area
55 * @param outPos the offset at the output array
56 * @param outLen the size of the uncompressed data
57 */
58 void expand(byte[] in, int inPos, int inLen, byte[] out, int outPos,
59 int outLen);
60
61 /**
62 * Set the compression options. This may include settings for
63 * higher performance but less compression.
64 *
65 * @param options the options
66 */
67 void setOptions(String options);
68 }