diff --git a/pom.xml b/pom.xml index 1dee5f48e91..78575ef17cf 100644 --- a/pom.xml +++ b/pom.xml @@ -387,6 +387,16 @@ commons-lang 2.6 + + org.apache.commons + commons-compress + 1.26.0 + + + com.github.luben + zstd-jni + 1.5.5-11 + com.google.code.gson gson diff --git a/src/org/rascalmpl/uri/CompressedStreamResolver.java b/src/org/rascalmpl/uri/CompressedStreamResolver.java index 8aaa7a179c0..1fd24dd6590 100644 --- a/src/org/rascalmpl/uri/CompressedStreamResolver.java +++ b/src/org/rascalmpl/uri/CompressedStreamResolver.java @@ -10,13 +10,9 @@ import org.apache.commons.compress.compressors.CompressorException; import org.apache.commons.compress.compressors.CompressorStreamFactory; -import com.github.luben.zstd.ZstdInputStream; -import com.github.luben.zstd.ZstdOutputStream; - import io.usethesource.vallang.ISourceLocation; public class CompressedStreamResolver implements ISourceLocationInputOutput { - private static final String ZSTD_COMPRESSION = "ZSTD"; private final URIResolverRegistry registry; public CompressedStreamResolver(URIResolverRegistry registry) { @@ -42,9 +38,6 @@ private ISourceLocation getActualURI(ISourceLocation wrappedURI) throws IOExcept } private static final InputStream getInputStream(String compressionMethod, InputStream original) throws IOException, CompressorException { - if (compressionMethod == ZSTD_COMPRESSION) { - return new ZstdInputStream(original); - } return new CompressorStreamFactory().createCompressorInputStream(compressionMethod, original); } @@ -68,9 +61,6 @@ public InputStream getInputStream(ISourceLocation uri) throws IOException { } private static final OutputStream getOutputStream(String compressionMethod, OutputStream original) throws IOException, CompressorException { - if (compressionMethod == ZSTD_COMPRESSION) { - return new ZstdOutputStream(original); - } return new CompressorStreamFactory().createCompressorOutputStream(compressionMethod, original); } @@ -120,7 +110,7 @@ private String detectCompression(ISourceLocation uri) throws IOException { case "lzma" : return CompressorStreamFactory.LZMA; case "Z" : return CompressorStreamFactory.Z; case "xz": return CompressorStreamFactory.XZ; - case "zst": return ZSTD_COMPRESSION; + case "zst": return CompressorStreamFactory.ZSTANDARD; case "7z": case "zip": case "rar":