You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2013/12/01 08:19:32 UTC
svn commit: r1546787 - in /commons/proper/compress/trunk/src:
main/java/org/apache/commons/compress/compressors/snappy/ site/xdoc/
Author: bodewig
Date: Sun Dec 1 07:19:32 2013
New Revision: 1546787
URL: http://svn.apache.org/r1546787
Log:
COMPRESS-147 document Snappy stuff, remove now unused Deconmpressor class
Added:
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/snappy/package.html (with props)
Removed:
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/snappy/SnappyDecompressor.java
Modified:
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java
commons/proper/compress/trunk/src/site/xdoc/examples.xml
commons/proper/compress/trunk/src/site/xdoc/index.xml
Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java?rev=1546787&r1=1546786&r2=1546787&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java (original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/snappy/FramedSnappyCompressorInputStream.java Sun Dec 1 07:19:32 2013
@@ -30,6 +30,8 @@ import org.apache.commons.compress.utils
/**
* CompressorInputStream for the framing Snappy format.
*
+ * <p>Based on the "spec" in the version "Last revised: 2013-10-25"</p>
+ *
* @see "http://code.google.com/p/snappy/source/browse/trunk/framing_format.txt"
* @since 1.7
*/
Added: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/snappy/package.html
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/snappy/package.html?rev=1546787&view=auto
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/snappy/package.html (added)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/snappy/package.html Sun Dec 1 07:19:32 2013
@@ -0,0 +1,38 @@
+<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 classes for decompressing streams using the
+ <a href="http://code.google.com/p/snappy/">Snappy</a>
+ algorithm.</p>
+
+ <p>The raw Snappy format which only contains the compressed data
+ is supported by the <code>SnappyCompressorInputStream</code>
+ class while the so called "framing format" is implemented
+ by <code>FramedSnappyCompressorInputStream</code>. Note there
+ have been different versions of the fraing format specification,
+ the implementation in Commons Compress is based on the
+ specification "Last revised: 2013-10-25".</p>
+
+ <p>Only the "framing format" can be auto-detected this means you
+ have to speficy the format explicitly if you want to read a
+ "raw" Snappy stream
+ via <code>CompressorStreamFactory</code>.</p>
+ </body>
+</html>
Propchange: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/snappy/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/proper/compress/trunk/src/site/xdoc/examples.xml
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/site/xdoc/examples.xml?rev=1546787&r1=1546786&r2=1546787&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/site/xdoc/examples.xml (original)
+++ commons/proper/compress/trunk/src/site/xdoc/examples.xml Sun Dec 1 07:19:32 2013
@@ -526,6 +526,33 @@ LOOP UNTIL entry.getSize() HAS BEEN READ
]]></source>
</subsection>
+ <subsection name="Snappy">
+
+ <p>There are two different "formats" used for <a
+ href="http://code.google.com/p/snappy/">Snappy</a>, one only
+ contains the raw compressed data while the other provides a
+ higher level "framing format" - Commons Compress offers two
+ different stream classes for reading either format.</p>
+
+ <p>Uncompressing a given framed Snappy file (you would
+ certainly add exception handling and make sure all streams
+ get closed properly):</p>
+<source><![CDATA[
+FileInputStream fin = new FileInputStream("archive.tar.sz");
+BufferedInputStream in = new BufferedInputStream(fin);
+FileOutputStream out = new FileOutputStream("archive.tar");
+FramedSnappyCompressorInputStream zIn = new FramedSnappyCompressorInputStream(in);
+final byte[] buffer = new byte[buffersize];
+int n = 0;
+while (-1 != (n = zIn.read(buffer))) {
+ out.write(buffer, 0, n);
+}
+out.close();
+zIn.close();
+]]></source>
+
+ </subsection>
+
</section>
</body>
</document>
Modified: commons/proper/compress/trunk/src/site/xdoc/index.xml
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/site/xdoc/index.xml?rev=1546787&r1=1546786&r2=1546787&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/site/xdoc/index.xml (original)
+++ commons/proper/compress/trunk/src/site/xdoc/index.xml Sun Dec 1 07:19:32 2013
@@ -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 and Z files.
+ bzip2, 7z, arj, lzma, snappy and Z files.
</p>
<p>
The code in this component has many origins:
@@ -66,7 +66,13 @@
format.</li>
</ul>
</subsection>
- <!--subsection name="What's coming in 1.7?"-->
+ <subsection name="What's coming in 1.7?">
+ <ul>
+ <li>Read-only support for the Snappy compression.</li>
+ <li>Read-only support for the traditional Unix compress
+ format used for <code>.Z</code> files.</li>
+ </ul>
+ </subsection>
</section>
<section name="Documentation">
@@ -84,8 +90,8 @@
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.6 support for
- the lzma format is read-only.</p>
+ Java</a> library. As of Commons Compress 1.7 support for
+ the lzma, Z and Snappy 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>