Add LZ4 HC
This commit is contained in:
parent
c04b7a7869
commit
ec24536261
@ -0,0 +1,26 @@
|
||||
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.jpountz.lz4.LZ4Compressor;
|
||||
import net.jpountz.lz4.LZ4Factory;
|
||||
import net.jpountz.lz4.LZ4SafeDecompressor;
|
||||
|
||||
/**
|
||||
* @author Mark Vainomaa
|
||||
*/
|
||||
public class LZ4HC extends AbstractAlgorithm {
|
||||
@Getter private final String name = "LZ4 HC";
|
||||
private final LZ4Factory factory = LZ4Factory.fastestInstance();
|
||||
|
||||
@Override
|
||||
public byte[] compress(byte[] input) {
|
||||
LZ4Compressor compressor = factory.highCompressor(17); // From LZ4Constants
|
||||
return compressor.compress(input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] decompress(byte[] input) {
|
||||
LZ4SafeDecompressor decompressor = factory.safeDecompressor();
|
||||
return decompressor.decompress(input, 8192);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user