Add Zstandard and Brotli alg tests
This commit is contained in:
parent
5baff562c7
commit
6690855df5
14
README.md
14
README.md
@ -3,4 +3,16 @@
|
||||
_(ametlik nimi uurimustööl?)_
|
||||
|
||||
## Uurimustöö programmi jooksutamine
|
||||
`git clone https://git.wut.ee/mikroskeem/java-class-compression-research` ja `mvn`. Java 8 on vajalik.
|
||||
`git clone https://git.wut.ee/mikroskeem/java-class-compression-research` ja `mvn`. Java 8 on vajalik.
|
||||
|
||||
## Testitud algoritmid
|
||||
- BZip2
|
||||
- GZip
|
||||
- LZ4 (fast ja HC)
|
||||
- LZMA
|
||||
- XZ
|
||||
- Zip
|
||||
|
||||
## Mittetuntud testitud algoritmid
|
||||
- [Brotli](https://github.com/google/brotli)
|
||||
- [Zstandard](https://github.com/facebook/zstd)
|
19
pom.xml
19
pom.xml
@ -27,6 +27,11 @@
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>bintray-nitram509-jbrotli</id>
|
||||
<name>bintray</name>
|
||||
<url>http://dl.bintray.com/nitram509/jbrotli</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
@ -102,5 +107,19 @@
|
||||
<artifactId>lz4</artifactId>
|
||||
<version>1.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Brotli -->
|
||||
<dependency>
|
||||
<groupId>org.meteogroup.jbrotli</groupId>
|
||||
<artifactId>jbrotli</artifactId>
|
||||
<version>0.5.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Zstandard -->
|
||||
<dependency>
|
||||
<groupId>com.github.luben</groupId>
|
||||
<artifactId>zstd-jni</artifactId>
|
||||
<version>1.1.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -0,0 +1,31 @@
|
||||
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.meteogroup.jbrotli.BrotliStreamCompressor;
|
||||
import org.meteogroup.jbrotli.BrotliStreamDeCompressor;
|
||||
import org.meteogroup.jbrotli.libloader.BrotliLibraryLoader;
|
||||
|
||||
/**
|
||||
* @author Mark Vainomaa
|
||||
*/
|
||||
public class Brotli extends AbstractAlgorithm {
|
||||
@Getter private final String name = "Brotli";
|
||||
|
||||
static {
|
||||
BrotliLibraryLoader.loadBrotli();
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] compress(byte[] input) {
|
||||
BrotliStreamCompressor compressor = new BrotliStreamCompressor();
|
||||
return compressor.compressArray(input, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] decompress(byte[] input) {
|
||||
BrotliStreamDeCompressor decompressor = new BrotliStreamDeCompressor();
|
||||
byte[] buf = new byte[8192]; // *sigh*
|
||||
decompressor.deCompress(input, buf);
|
||||
return buf;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||
|
||||
import com.github.luben.zstd.ZstdInputStream;
|
||||
import com.github.luben.zstd.ZstdOutputStream;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* @author Mark Vainomaa
|
||||
*/
|
||||
public class Zstandard extends AbstractAlgorithm {
|
||||
@Getter private final String name = "Zstandard";
|
||||
|
||||
@Override
|
||||
public OutputStream createCompressor(OutputStream outputStream) throws IOException {
|
||||
return new ZstdOutputStream(outputStream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream createDecompressor(InputStream inputStream) throws IOException {
|
||||
return new ZstdInputStream(inputStream);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user