From d80b7b190c789c33a15f56613a21c44827a63c75 Mon Sep 17 00:00:00 2001 From: Michael Simacek Date: Mon, 12 Feb 2018 10:59:55 +0100 Subject: [PATCH 2/3] Remove ZSTD compressor --- .../compressors/CompressorStreamFactory.java | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java index 2406d5a44..9ed40a3d7 100644 --- a/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java +++ b/src/main/java/org/apache/commons/compress/compressors/CompressorStreamFactory.java @@ -53,9 +53,6 @@ import org.apache.commons.compress.compressors.xz.XZCompressorOutputStream; import org.apache.commons.compress.compressors.xz.XZUtils; import org.apache.commons.compress.compressors.z.ZCompressorInputStream; -import org.apache.commons.compress.compressors.zstandard.ZstdCompressorInputStream; -import org.apache.commons.compress.compressors.zstandard.ZstdCompressorOutputStream; -import org.apache.commons.compress.compressors.zstandard.ZstdUtils; import org.apache.commons.compress.utils.IOUtils; import org.apache.commons.compress.utils.Sets; @@ -280,10 +277,6 @@ static String detect(final InputStream inputStream, final Set compressor return LZ4_FRAMED; } - if (compressorNames.contains(ZSTANDARD) && ZstdUtils.matches(signature, signatureLength)) { - return ZSTANDARD; - } - throw new CompressorException("No Compressor found for the stream signature."); } @@ -405,10 +398,6 @@ public static String getZ() { return Z; } - public static String getZstandard() { - return ZSTANDARD; - } - static void putAll(final Set names, final CompressorStreamProvider provider, final TreeMap map) { names.forEach(name -> map.put(toKey(name), provider)); } @@ -513,7 +502,7 @@ public CompressorInputStream createCompressorInputStream(final InputStream in, f * Creates a compressor input stream from a compressor name and an input stream. * * @param name of the compressor, i.e. {@value #GZIP}, {@value #BZIP2}, {@value #XZ}, {@value #LZMA}, {@value #PACK200}, {@value #SNAPPY_RAW}, - * {@value #SNAPPY_FRAMED}, {@value #Z}, {@value #LZ4_BLOCK}, {@value #LZ4_FRAMED}, {@value #ZSTANDARD}, {@value #DEFLATE64} or + * {@value #SNAPPY_FRAMED}, {@value #Z}, {@value #LZ4_BLOCK}, {@value #LZ4_FRAMED}, {@value #DEFLATE64} or * {@value #DEFLATE} * @param in the input stream * @return compressor input stream @@ -554,10 +543,7 @@ public CompressorInputStream createCompressorInputStream(final String name, fina } if (ZSTANDARD.equalsIgnoreCase(name)) { - if (!ZstdUtils.isZstdCompressionAvailable()) { - throw new CompressorException("Zstandard compression is not available." + YOU_NEED_ZSTD_JNI); - } - return new ZstdCompressorInputStream(in); + throw new CompressorException("Zstandard compression is not available in this build."); } if (LZMA.equalsIgnoreCase(name)) { @@ -614,7 +600,7 @@ public CompressorInputStream createCompressorInputStream(final String name, fina * Creates a compressor output stream from a compressor name and an output stream. * * @param name the compressor name, i.e. {@value #GZIP}, {@value #BZIP2}, {@value #XZ}, {@value #PACK200}, {@value #SNAPPY_FRAMED}, {@value #LZ4_BLOCK}, - * {@value #LZ4_FRAMED}, {@value #ZSTANDARD} or {@value #DEFLATE} + * {@value #LZ4_FRAMED} or {@value #DEFLATE} * @param out the output stream * @return the compressor output stream * @throws CompressorException if the archiver name is not known @@ -665,7 +651,7 @@ public CompressorOutputStream createCompressorOutputStream(final String name, fi } if (ZSTANDARD.equalsIgnoreCase(name)) { - return new ZstdCompressorOutputStream(out); + throw new CompressorException("Zstandard compression is not available in this build."); } } catch (final IOException e) { throw new CompressorException("Could not create CompressorOutputStream", e); -- 2.43.0