Add LZO
This commit is contained in:
parent
6690855df5
commit
76fc847e14
7
pom.xml
7
pom.xml
@ -121,5 +121,12 @@
|
||||
<artifactId>zstd-jni</artifactId>
|
||||
<version>1.1.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- LZO -->
|
||||
<dependency>
|
||||
<groupId>org.anarres.lzo</groupId>
|
||||
<artifactId>lzo-core</artifactId>
|
||||
<version>1.0.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user