Author: bodewig
Date: Sun Jun 9 12:01:21 2013
New Revision: 1491187
URL: http://svn.apache.org/r1491187
Log:
COMPRESS-111 document lzma support
Modified:
commons/proper/compress/branches/LZMA/src/site/xdoc/examples.xml
commons/proper/compress/branches/LZMA/src/site/xdoc/index.xml
Modified: commons/proper/compress/branches/LZMA/src/site/xdoc/examples.xml
URL:
http://svn.apache.org/viewvc/commons/proper/compress/branches/LZMA/src/site/xdoc/examples.xml?rev=1491187&r1=1491186&r2=1491187&view=diff
==============================================================================
--- commons/proper/compress/branches/LZMA/src/site/xdoc/examples.xml (original)
+++ commons/proper/compress/branches/LZMA/src/site/xdoc/examples.xml Sun Jun 9
12:01:21 2013
@@ -31,11 +31,13 @@
collect multiple entries inside a single (potentially
compressed) archive are archiver formats.</p>
- <p>The compressor formats supported are gzip, bzip2, xz and
+ <p>The compressor formats supported are gzip, bzip2, xz, lzma and
Pack200, the archiver formats are ar, cpio, tar and zip as
well as dump, 7z and arj for which we currently only support
reading. Pack200 is a special case as it can only compress
JAR files.</p>
+
+ <p>We currently only provide read support for lzma as well.</p>
</subsection>
<subsection name="Common Notes">
@@ -76,6 +78,10 @@ CompressorInputStream input = new Compre
.createCompressorInputStream(originalInput);
]]></source>
+ <p>Note that there is no way to detect the lzma format so only
+ the two-arg version of
+ <code>createCompressorInputStream</code> can be used.</p>
+
</subsection>
<subsection name="Unsupported Features">
@@ -425,6 +431,30 @@ xzIn.close();
]]></source>
</subsection>
+ <subsection name="lzma">
+
+ <p>The implementation of this package is provided by the
+ public domain <a href="http://tukaani.org/xz/java.html">XZ
+ for Java</a> library.</p>
+
+ <p>Uncompressing a given lzma compressed file (you would
+ certainly add exception handling and make sure all streams
+ get closed properly):</p>
+<source><![CDATA[
+FileInputStream fin = new FileInputStream("archive.tar.lzma");
+BufferedInputStream in = new BufferedInputStream(fin);
+FileOutputStream out = new FileOutputStream("archive.tar");
+LZMACompressorInputStream lzmaIn = new LZMACompressorInputStream(in);
+final byte[] buffer = new byte[buffersize];
+int n = 0;
+while (-1 != (n = xzIn.read(buffer))) {
+ out.write(buffer, 0, n);
+}
+out.close();
+lzmaIn.close();
+]]></source>
+ </subsection>
+
<subsection name="7z">
<p>Note that Commons Compress currently only supports
Modified: commons/proper/compress/branches/LZMA/src/site/xdoc/index.xml
URL:
http://svn.apache.org/viewvc/commons/proper/compress/branches/LZMA/src/site/xdoc/index.xml?rev=1491187&r1=1491186&r2=1491187&view=diff
==============================================================================
--- commons/proper/compress/branches/LZMA/src/site/xdoc/index.xml (original)
+++ commons/proper/compress/branches/LZMA/src/site/xdoc/index.xml Sun Jun 9
12:01:21 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 and arj files.
+ bzip2, 7z, arj and lzma files.
</p>
<p>
The code in this component has many origins:
@@ -64,13 +64,14 @@
by <code>ArchiveEntry</code> instances which in turn
usually correspond to single files or directories.</p>
- <p>Currently the bzip2, Pack200, XZ and gzip formats are
+ <p>Currently the bzip2, Pack200, XZ, gzip and lzma 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 support is provided by the public
+ 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.</p>
+ Java</a> library. As of Commons Compress 1.6 support for
+ the lzma 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>