This commit is contained in:
Mark Vainomaa 2017-03-27 20:40:19 +03:00
parent 6690855df5
commit 76fc847e14
2 changed files with 36 additions and 0 deletions

View File

@ -121,5 +121,12 @@
<artifactId>zstd-jni</artifactId> <artifactId>zstd-jni</artifactId>
<version>1.1.4</version> <version>1.1.4</version>
</dependency> </dependency>
<!-- LZO -->
<dependency>
<groupId>org.anarres.lzo</groupId>
<artifactId>lzo-core</artifactId>
<version>1.0.5</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -0,0 +1,29 @@
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
import lombok.Getter;
import org.anarres.lzo.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* @author Mark Vainomaa
*/
public class LZO extends AbstractAlgorithm {
@Getter private final String name = "LZO";
@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);
}
}