Skip to content

Commit

Permalink
Remove apache compress dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
DavyLandman committed Feb 21, 2024
1 parent a07b754 commit 6cf6069
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
5 changes: 0 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,6 @@
<artifactId>capsule</artifactId>
<version>0.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.26.0</version>
</dependency>
<dependency>
<groupId>org.tukaani</groupId>
<artifactId>xz</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.util.zip.GZIPInputStream;

import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
import org.apache.commons.compress.compressors.gzip.GzipParameters;
import org.apache.commons.compress.compressors.xz.XZCompressorOutputStream;
import java.util.zip.GZIPOutputStream;
import org.tukaani.xz.LZMA2Options;
import org.tukaani.xz.XZInputStream;

import org.tukaani.xz.XZOutputStream;
import com.github.luben.zstd.ZstdInputStream;
import com.github.luben.zstd.ZstdOutputStream;
import com.github.luben.zstd.util.Native;
Expand All @@ -54,12 +52,16 @@ public static boolean zstdAvailable() {
public static OutputStream wrapStream(OutputStream rawStream, int algorithm, int level) throws IOException {
switch (algorithm) {
case Header.Compression.GZIP: {
GzipParameters params = new GzipParameters();
params.setCompressionLevel(level);
return new GzipCompressorOutputStream(rawStream, params);
var result = new GZIPOutputStream(rawStream) {
public void setLevel(int level) {
def.setLevel(level);
}
};
result.setLevel(level);
return result;
}
case Header.Compression.XZ: {
return new XZCompressorOutputStream(rawStream, level);
return new XZOutputStream(rawStream, new LZMA2Options(level));
}
case Header.Compression.ZSTD: {
return new ZstdOutputStream(rawStream, level);
Expand Down

0 comments on commit 6cf6069

Please sign in to comment.