| 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 |
* This class implements a data compression algorithm that does in fact not |
| 10 |
* compress. This is useful if the data can not be compressed because it is |
| 11 |
* encrypted, already compressed, or random. |
| 12 |
*/ |
| 13 |
public class CompressNo implements Compressor { |
| 14 |
|
| 15 |
@Override |
| 16 |
public int getAlgorithm() { |
| 17 |
return Compressor.NO; |
| 18 |
} |
| 19 |
|
| 20 |
@Override |
| 21 |
public void setOptions(String options) { |
| 22 |
// nothing to do |
| 23 |
} |
| 24 |
|
| 25 |
@Override |
| 26 |
public int compress(byte[] in, int inPos, int inLen, byte[] out, int outPos) { |
| 27 |
System.arraycopy(in, inPos, out, outPos, inLen); |
| 28 |
return outPos + inLen; |
| 29 |
} |
| 30 |
|
| 31 |
@Override |
| 32 |
public void expand(byte[] in, int inPos, int inLen, byte[] out, int outPos, |
| 33 |
int outLen) { |
| 34 |
System.arraycopy(in, inPos, out, outPos, outLen); |
| 35 |
} |
| 36 |
|
| 37 |
} |