commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [1/3] commons-compress git commit: COMPRESS-392 record Brotli support
Date Thu, 04 May 2017 06:47:59 GMT
Repository: commons-compress
Updated Branches:
  refs/heads/master 037209cb3 -> ccf55ddf2


COMPRESS-392 record Brotli support


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/ac73d23c
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/ac73d23c
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/ac73d23c

Branch: refs/heads/master
Commit: ac73d23cd70908a48b647576c719875f58fc8e88
Parents: 037209c
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Thu May 4 08:40:29 2017 +0200
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Thu May 4 08:44:06 2017 +0200

----------------------------------------------------------------------
 pom.xml                                         |  2 +-
 .../brotli/BrotliCompressorInputStream.java     |  2 +-
 .../compress/compressors/brotli/package.html    | 26 ++++++++++++++++++++
 src/site/xdoc/examples.xml                      | 22 ++++++++++++++++-
 src/site/xdoc/index.xml                         | 13 +++++++---
 src/site/xdoc/limitations.xml                   | 10 ++++++++
 6 files changed, 68 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ac73d23c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 4cc629a..f707973 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@
   <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 and ar, cpio,
+lzma, xz, Snappy, traditional Unix Compress, DEFLATE, Brotli and ar, cpio,
 jar, tar, zip, dump, 7z, arj.
   </description>
 

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ac73d23c/src/main/java/org/apache/commons/compress/compressors/brotli/BrotliCompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/brotli/BrotliCompressorInputStream.java
b/src/main/java/org/apache/commons/compress/compressors/brotli/BrotliCompressorInputStream.java
index 1654b86..3f63cc8 100644
--- a/src/main/java/org/apache/commons/compress/compressors/brotli/BrotliCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/brotli/BrotliCompressorInputStream.java
@@ -24,7 +24,7 @@ import java.io.InputStream;
 import org.apache.commons.compress.compressors.CompressorInputStream;
 
 /**
- * {@link FilterInputStream} implementation to decode Brotli encoded stream.
+ * {@link CompressorInputStream} implementation to decode Brotli encoded stream.
  * Library relies on <a href="https://github.com/google/brotli">Google brotli</a>
  * 
  * @since 1.14

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ac73d23c/src/main/java/org/apache/commons/compress/compressors/brotli/package.html
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/brotli/package.html b/src/main/java/org/apache/commons/compress/compressors/brotli/package.html
new file mode 100644
index 0000000..7654cf6
--- /dev/null
+++ b/src/main/java/org/apache/commons/compress/compressors/brotli/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
+      Brotli algorithm based
+      on <a href="https://github.com/google/brotli">Google's Brotli
+      decoder</a>.</p>
+  </body>
+</html>

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ac73d23c/src/site/xdoc/examples.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/examples.xml b/src/site/xdoc/examples.xml
index 16eb2a2..7a9ae0d 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 format so only
+        <p>Note that there is no way to detect the lzma 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
@@ -479,6 +479,26 @@ LOOP UNTIL entry.getSize() HAS BEEN READ {
 ]]></source>
       </subsection>
 
+      <subsection name="Brotli">
+
+        <p>Uncompressing a given Brotli 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"));
+BrotliCompressorInputStream brIn = new BrotliCompressorInputStream(in);
+final byte[] buffer = new byte[buffersize];
+int n = 0;
+while (-1 != (n = brIn.read(buffer))) {
+    out.write(buffer, 0, n);
+}
+out.close();
+brIn.close();
+]]></source>
+      </subsection>
+
       <subsection name="bzip2">
 
         <p>Note that <code>BZipCompressorOutputStream</code> keeps

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/ac73d23c/src/site/xdoc/index.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index f4f77f1..6924161 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -27,7 +27,7 @@
             <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 and Z files.
+                bzip2, 7z, arj, lzma, snappy, DEFLATE, lz4, Brotli and Z files.
             </p>
             <p>
                 The code in this component has many origins:
@@ -61,7 +61,10 @@
             <ul>
               <li>Added support for writing the Snappy format</li>
               <li>Added support for the LZ4 compression format</li>
-              <li>Added support for Brotli decompression</li>
+              <li>Added read-only support for Brotli decompression by
+              using the <a
+              href="https://github.com/google/brotli">Google Brotli
+              decoder</a>.</li>
             </ul>
           </subsection>
           <subsection name="What's new in 1.13?">
@@ -100,8 +103,10 @@
             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.  As of Commons Compress 1.14 support for
-            the Z format is read-only.</p>
+            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.14 support for
+            the Z 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/ac73d23c/src/site/xdoc/limitations.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/limitations.xml b/src/site/xdoc/limitations.xml
index fd0c07e..c8430e7 100644
--- a/src/site/xdoc/limitations.xml
+++ b/src/site/xdoc/limitations.xml
@@ -71,6 +71,16 @@
          archives</li>
        </ul>
      </section>
+     <section name="Brotli">
+       <ul>
+         <li>the format requires the otherwise optional <a
+         href="https://github.com/google/brotli">Google Brotli dec</a>
+         library.</li>
+         <li>read-only support</li>
+         <li><code>CompressorStreamFactory</code> is not able to auto-detect
+         streams using Brotli compression.</li>
+       </ul>
+     </section>
      <section name="BZIP2">
        <p>Versions of Compress prior to 1.4.1 are vulnerable to a
        possible denial of service attack, see the <a


Mime
View raw message