Repository: commons-compress Updated Branches: refs/heads/master 1c382914c -> 495712ce6
COMPRESS-423 documentation for ZStandard Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/ce5ada6c Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/ce5ada6c Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/ce5ada6c Branch: refs/heads/master Commit: ce5ada6c57eac893ae95a3bffc06eeee3fa07711 Parents: 1c38291 Author: Stefan Bodewig <bode...@apache.org> Authored: Tue Oct 17 20:34:21 2017 +0200 Committer: Stefan Bodewig <bode...@apache.org> Committed: Tue Oct 17 20:34:21 2017 +0200 ---------------------------------------------------------------------- pom.xml | 4 +-- src/changes/changes.xml | 5 ++++ .../compress/compressors/zstandard/package.html | 26 ++++++++++++++++++++ src/site/xdoc/examples.xml | 22 ++++++++++++++++- src/site/xdoc/index.xml | 22 ++++++++++++----- src/site/xdoc/limitations.xml | 10 ++++++++ 6 files changed, 80 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ce5ada6c/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 6a33b38..6298895 100644 --- a/pom.xml +++ b/pom.xml @@ -32,8 +32,8 @@ <description> Apache Commons Compress software defines an API for working with compression and archive formats. These include: bzip2, gzip, pack200, -lzma, xz, Snappy, traditional Unix Compress, DEFLATE, LZ4, Brotli and ar, cpio, -jar, tar, zip, dump, 7z, arj. +lzma, xz, Snappy, traditional Unix Compress, DEFLATE, LZ4, Brotli, +ZStandard and ar, cpio, jar, tar, zip, dump, 7z, arj. </description> <properties> http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ce5ada6c/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 67c3b38..68c383e 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -44,6 +44,11 @@ The <action> type attribute can be add,update,fix,remove. <body> <release version="1.16" date="not released, yet" description="Release 1.16"> + <action issue="COMPRESS-423" type="add" date="2017-10-17" + due-to="Andre F de Miranda"> + Add read-only support for ZStandard compression based on the + Zstd-jni project. + </action> </release> <release version="1.15" date="2017-10-17" description="Release 1.15 http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ce5ada6c/src/main/java/org/apache/commons/compress/compressors/zstandard/package.html ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/compress/compressors/zstandard/package.html b/src/main/java/org/apache/commons/compress/compressors/zstandard/package.html new file mode 100644 index 0000000..f9c47ec --- /dev/null +++ b/src/main/java/org/apache/commons/compress/compressors/zstandard/package.html @@ -0,0 +1,26 @@ +<html> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +--> + <body> + <p>Provides stream class for decompressing streams using the + ZStandard algorithm based + on <a href="https://github.com/luben/zstd-jni">ZStandard + JNI</a>.</p> + </body> +</html> http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ce5ada6c/src/site/xdoc/examples.xml ---------------------------------------------------------------------- diff --git a/src/site/xdoc/examples.xml b/src/site/xdoc/examples.xml index 87fee1a..87c18bb 100644 --- a/src/site/xdoc/examples.xml +++ b/src/site/xdoc/examples.xml @@ -82,7 +82,7 @@ CompressorInputStream input = new CompressorStreamFactory() .createCompressorInputStream(originalInput); ]]></source> - <p>Note that there is no way to detect the lzma or Brotli formats so only + <p>Note that there is no way to detect the lzma, ZStandard or Brotli formats so only the two-arg version of <code>createCompressorInputStream</code> can be used. Prior to Compress 1.9 the .Z format hasn't been auto-detected @@ -884,6 +884,26 @@ in.close(); </subsection> + <subsection name="ZStandard"> + + <p>Uncompressing a given ZStandard compressed file (you would + certainly add exception handling and make sure all streams + get closed properly):</p> +<source><![CDATA[ +InputStream fin = Files.newInputStream(Paths.get("archive.tar.br")); +BufferedInputStream in = new BufferedInputStream(fin); +OutputStream out = Files.newOutputStream(Paths.get("archive.tar")); +ZstdCompressorInputStream zsIn = new ZstdCompressorInputStream(in); +final byte[] buffer = new byte[buffersize]; +int n = 0; +while (-1 != (n = zsIn.read(buffer))) { + out.write(buffer, 0, n); +} +out.close(); +zsIn.close(); +]]></source> + </subsection> + <subsection name="Extending Commons Compress"> <p> http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ce5ada6c/src/site/xdoc/index.xml ---------------------------------------------------------------------- diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml index f7955d1..84f5aff 100644 --- a/src/site/xdoc/index.xml +++ b/src/site/xdoc/index.xml @@ -26,8 +26,9 @@ <section name="Apache Commons Compress™"> <p> The Apache Commons Compress library defines an API for - working with ar, cpio, Unix dump, tar, zip, gzip, XZ, Pack200, - bzip2, 7z, arj, lzma, snappy, DEFLATE, lz4, Brotli and Z files. + working with ar, cpio, Unix dump, tar, zip, gzip, XZ, + Pack200, bzip2, 7z, arj, lzma, snappy, DEFLATE, lz4, + Brotli, ZStandard and Z files. </p> <p> The code in this component has many origins: @@ -65,6 +66,12 @@ </ul> </subsection> + <subsection name="What's coming in 1.16?"> + <ul> + <li>Read-only support for ZStandard compression.</li> + </ul> + </subsection> + </section> <section name="Documentation"> @@ -76,16 +83,19 @@ by <code>ArchiveEntry</code> instances which in turn usually correspond to single files or directories.</p> - <p>Currently the bzip2, Pack200, XZ, gzip, lzma and Z formats are + <p>Currently the bzip2, Pack200, XZ, gzip, lzma, brotli, + ZStandard and Z formats are supported as compressors where gzip support is mostly provided by the <code>java.util.zip</code> package and Pack200 support by the <code>java.util.jar</code> package of the Java class library. XZ and lzma support is provided by the public domain <a href="http://tukaani.org/xz/java.html">XZ for Java</a> library. Brotli support is provided by the MIT - licensed <a href="https://github.com/google/brotli">Google Brotli decoder</a>. - As of Commons Compress 1.15 support for - the Z and Brotli formats is read-only.</p> + licensed <a href="https://github.com/google/brotli">Google + Brotli decoder</a>. ZStandard support is provided by the BSD + licensed <a href="https://github.com/luben/zstd-jni">Zstd-jni</a>. + As of Commons Compress 1.16 support for the Z, ZStandard + and Brotli formats is read-only.</p> <p>The ar, arj, cpio, dump, tar, 7z and zip formats are supported as archivers where the <a href="zip.html">zip</a> http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ce5ada6c/src/site/xdoc/limitations.xml ---------------------------------------------------------------------- diff --git a/src/site/xdoc/limitations.xml b/src/site/xdoc/limitations.xml index c8430e7..af8a3f4 100644 --- a/src/site/xdoc/limitations.xml +++ b/src/site/xdoc/limitations.xml @@ -194,5 +194,15 @@ different versions of Java.</li> </ul> </section> + <section name="ZStandard"> + <ul> + <li>the format requires the otherwise optional <a + href="https://github.com/luben/zstd-jni">ZStandard JNI</a> + library.</li> + <li>read-only support</li> + <li><code>CompressorStreamFactory</code> is not able to auto-detect + streams using ZStandard compression.</li> + </ul> + </section> </body> </document>