2017-03-27 20:40:19 +03:00
|
|
|
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
|
|
|
|
2018-01-28 21:11:10 +02:00
|
|
|
import org.anarres.lzo.LzoAlgorithm;
|
|
|
|
import org.anarres.lzo.LzoCompressor;
|
|
|
|
import org.anarres.lzo.LzoDecompressor;
|
|
|
|
import org.anarres.lzo.LzoInputStream;
|
|
|
|
import org.anarres.lzo.LzoLibrary;
|
|
|
|
import org.anarres.lzo.LzoOutputStream;
|
2017-03-27 20:40:19 +03:00
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Mark Vainomaa
|
|
|
|
*/
|
|
|
|
public class LZO extends AbstractAlgorithm {
|
2018-01-28 21:39:38 +02:00
|
|
|
@Override public String getName() { return "LZO"; }
|
2017-03-27 20:40:19 +03:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public OutputStream createCompressor(OutputStream outputStream) throws IOException {
|
|
|
|
LzoAlgorithm algorithm = LzoAlgorithm.LZO1X;
|
|
|
|
LzoCompressor compressor = LzoLibrary.getInstance().newCompressor(algorithm, null);
|
|
|
|
return new LzoOutputStream(outputStream, compressor, 256);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public InputStream createDecompressor(InputStream inputStream) throws IOException {
|
|
|
|
LzoAlgorithm algorithm = LzoAlgorithm.LZO1X;
|
|
|
|
LzoDecompressor decompressor = LzoLibrary.getInstance().newDecompressor(algorithm, null);
|
|
|
|
return new LzoInputStream(inputStream, decompressor);
|
|
|
|
}
|
|
|
|
}
|