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 2018/05/06 10:32:08 UTC

[3/5] commons-compress git commit: alpha-sort formats

alpha-sort formats


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

Branch: refs/heads/master
Commit: b78ced2f4a3797b3cac85807a292f774cab2dab8
Parents: 66347f4
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sun May 6 12:24:55 2018 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sun May 6 12:24:55 2018 +0200

----------------------------------------------------------------------
 src/site/xdoc/examples.xml | 526 ++++++++++++++++++++--------------------
 1 file changed, 263 insertions(+), 263 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/b78ced2f/src/site/xdoc/examples.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/examples.xml b/src/site/xdoc/examples.xml
index c4f1f31..a9154ab 100644
--- a/src/site/xdoc/examples.xml
+++ b/src/site/xdoc/examples.xml
@@ -119,6 +119,80 @@ CompressorInputStream input = new CompressorStreamFactory()
 
       </subsection>
 
+      <subsection name="7z">
+
+        <p>Note that Commons Compress currently only supports a subset
+        of compression and encryption algorithms used for 7z archives.
+        For writing only uncompressed entries, LZMA, LZMA2, BZIP2 and
+        Deflate are supported - in addition to those reading supports
+        AES-256/SHA-256 and DEFLATE64.</p>
+
+        <p>Multipart archives are not supported at all.</p>
+
+        <p>7z archives can use multiple compression and encryption
+        methods as well as filters combined as a pipeline of methods
+        for its entries.  Prior to Compress 1.8 you could only specify
+        a single method when creating archives - reading archives
+        using more than one method has been possible before.  Starting
+        with Compress 1.8 it is possible to configure the full
+        pipeline using the <code>setContentMethods</code> method of
+        <code>SevenZOutputFile</code>.  Methods are specified in the
+        order they appear inside the pipeline when creating the
+        archive, you can also specify certain parameters for some of
+        the methods - see the Javadocs of
+        <code>SevenZMethodConfiguration</code> for details.</p>
+
+        <p>When reading entries from an archive the
+        <code>getContentMethods</code> method of
+        <code>SevenZArchiveEntry</code> will properly represent the
+        compression/encryption/filter methods but may fail to
+        determine the configuration options used.  As of Compress 1.8
+        only the dictionary size used for LZMA2 can be read.</p>
+
+        <p>Currently solid compression - compressing multiple files
+        as a single block to benefit from patterns repeating accross
+        files - is only supported when reading archives.  This also
+        means compression ratio will likely be worse when using
+        Commons Compress compared to the native 7z executable.</p>
+
+        <p>Reading or writing requires a
+        <code>SeekableByteChannel</code> that will be obtained
+        transparently when reading from or writing to a file. The
+        class
+        <code>org.apache.commons.compress.utils.SeekableInMemoryByteChannel</code>
+        allows you to read from or write to an in-memory archive.</p>
+
+        <p>Adding an entry to a 7z archive:</p>
+<source><![CDATA[
+SevenZOutputFile sevenZOutput = new SevenZOutputFile(file);
+SevenZArchiveEntry entry = sevenZOutput.createArchiveEntry(fileToArchive, name);
+sevenZOutput.putArchiveEntry(entry);
+sevenZOutput.write(contentOfEntry);
+sevenZOutput.closeArchiveEntry();
+]]></source>
+
+        <p>Uncompressing a given 7z archive (you would
+          certainly add exception handling and make sure all streams
+          get closed properly):</p>
+<source><![CDATA[
+SevenZFile sevenZFile = new SevenZFile(new File("archive.7z"));
+SevenZArchiveEntry entry = sevenZFile.getNextEntry();
+byte[] content = new byte[entry.getSize()];
+LOOP UNTIL entry.getSize() HAS BEEN READ {
+    sevenZFile.read(content, offset, content.length - offset);
+}
+]]></source>
+
+          <p>Uncompressing a given in-memory 7z archive:</p>
+          <source><![CDATA[
+byte[] inputData; // 7z archive contents
+SeekableInMemoryByteChannel inMemoryByteChannel = new SeekableInMemoryByteChannel(inputData);
+SevenZFile sevenZFile = new SevenZFile(inMemoryByteChannel);
+SevenZArchiveEntry entry = sevenZFile.getNextEntry();
+sevenZFile.read();  // read current entry's data
+]]></source>
+      </subsection>
+
       <subsection name="ar">
 
         <p>In addition to the information stored
@@ -185,6 +259,23 @@ LOOP UNTIL entry.getSize() HAS BEEN READ {
 
       </subsection>
 
+      <subsection name="arj">
+
+        <p>Note that Commons Compress doesn't support compressed,
+        encrypted or multi-volume ARJ archives, yet.</p>
+
+        <p>Uncompressing a given arj archive (you would
+          certainly add exception handling and make sure all streams
+          get closed properly):</p>
+<source><![CDATA[
+ArjArchiveEntry entry = arjInput.getNextEntry();
+byte[] content = new byte[entry.getSize()];
+LOOP UNTIL entry.getSize() HAS BEEN READ {
+    arjInput.read(content, offset, content.length - offset);
+}
+]]></source>
+      </subsection>
+
       <subsection name="cpio">
 
         <p>In addition to the information stored
@@ -225,6 +316,49 @@ LOOP UNTIL entry.getSize() HAS BEEN READ {
 
       </subsection>
 
+      <subsection name="jar">
+        <p>In general, JAR archives are ZIP files, so the JAR package
+          supports all options provided by the <a href="#zip">ZIP</a> package.</p>
+
+        <p>To be interoperable JAR archives should always be created
+          using the UTF-8 encoding for file names (which is the
+          default).</p>
+
+        <p>Archives created using <code>JarArchiveOutputStream</code>
+          will implicitly add a <code>JarMarker</code> extra field to
+          the very first archive entry of the archive which will make
+          Solaris recognize them as Java archives and allows them to
+          be used as executables.</p>
+
+        <p>Note that <code>ArchiveStreamFactory</code> doesn't
+          distinguish ZIP archives from JAR archives, so if you use
+          the one-argument <code>createArchiveInputStream</code>
+          method on a JAR archive, it will still return the more
+          generic <code>ZipArchiveInputStream</code>.</p>
+
+        <p>The <code>JarArchiveEntry</code> class contains fields for
+          certificates and attributes that are planned to be supported
+          in the future but are not supported as of Compress 1.0.</p>
+
+        <p>Adding an entry to a jar archive:</p>
+<source><![CDATA[
+JarArchiveEntry entry = new JarArchiveEntry(name, size);
+entry.setSize(size);
+jarOutput.putArchiveEntry(entry);
+jarOutput.write(contentOfEntry);
+jarOutput.closeArchiveEntry();
+]]></source>
+
+        <p>Reading entries from an jar archive:</p>
+<source><![CDATA[
+JarArchiveEntry entry = jarInput.getNextJarEntry();
+byte[] content = new byte[entry.getSize()];
+LOOP UNTIL entry.getSize() HAS BEEN READ {
+    jarInput.read(content, offset, content.length - offset);
+}
+]]></source>
+      </subsection>
+
       <subsection name="dump">
 
         <p>In addition to the information stored
@@ -356,144 +490,10 @@ public class ScatterSample {
   throws IOException, ExecutionException, InterruptedException {
      dirs.writeTo(zipArchiveOutputStream);
      dirs.close();
-     scatterZipCreator.writeTo(zipArchiveOutputStream);
-  }
-}
-</source>
-      </subsection>
-
-      <subsection name="jar">
-        <p>In general, JAR archives are ZIP files, so the JAR package
-          supports all options provided by the ZIP package.</p>
-
-        <p>To be interoperable JAR archives should always be created
-          using the UTF-8 encoding for file names (which is the
-          default).</p>
-
-        <p>Archives created using <code>JarArchiveOutputStream</code>
-          will implicitly add a <code>JarMarker</code> extra field to
-          the very first archive entry of the archive which will make
-          Solaris recognize them as Java archives and allows them to
-          be used as executables.</p>
-
-        <p>Note that <code>ArchiveStreamFactory</code> doesn't
-          distinguish ZIP archives from JAR archives, so if you use
-          the one-argument <code>createArchiveInputStream</code>
-          method on a JAR archive, it will still return the more
-          generic <code>ZipArchiveInputStream</code>.</p>
-
-        <p>The <code>JarArchiveEntry</code> class contains fields for
-          certificates and attributes that are planned to be supported
-          in the future but are not supported as of Compress 1.0.</p>
-
-        <p>Adding an entry to a jar archive:</p>
-<source><![CDATA[
-JarArchiveEntry entry = new JarArchiveEntry(name, size);
-entry.setSize(size);
-jarOutput.putArchiveEntry(entry);
-jarOutput.write(contentOfEntry);
-jarOutput.closeArchiveEntry();
-]]></source>
-
-        <p>Reading entries from an jar archive:</p>
-<source><![CDATA[
-JarArchiveEntry entry = jarInput.getNextJarEntry();
-byte[] content = new byte[entry.getSize()];
-LOOP UNTIL entry.getSize() HAS BEEN READ {
-    jarInput.read(content, offset, content.length - offset);
-}
-]]></source>
-      </subsection>
-
-      <subsection name="7z">
-
-        <p>Note that Commons Compress currently only supports a subset
-        of compression and encryption algorithms used for 7z archives.
-        For writing only uncompressed entries, LZMA, LZMA2, BZIP2 and
-        Deflate are supported - reading also supports
-        AES-256/SHA-256 and DEFLATE64.</p>
-
-        <p>Multipart archives are not supported at all.</p>
-
-        <p>7z archives can use multiple compression and encryption
-        methods as well as filters combined as a pipeline of methods
-        for its entries.  Prior to Compress 1.8 you could only specify
-        a single method when creating archives - reading archives
-        using more than one method has been possible before.  Starting
-        with Compress 1.8 it is possible to configure the full
-        pipeline using the <code>setContentMethods</code> method of
-        <code>SevenZOutputFile</code>.  Methods are specified in the
-        order they appear inside the pipeline when creating the
-        archive, you can also specify certain parameters for some of
-        the methods - see the Javadocs of
-        <code>SevenZMethodConfiguration</code> for details.</p>
-
-        <p>When reading entries from an archive the
-        <code>getContentMethods</code> method of
-        <code>SevenZArchiveEntry</code> will properly represent the
-        compression/encryption/filter methods but may fail to
-        determine the configuration options used.  As of Compress 1.8
-        only the dictionary size used for LZMA2 can be read.</p>
-
-        <p>Currently solid compression - compressing multiple files
-        as a single block to benefit from patterns repeating accross
-        files - is only supported when reading archives.  This also
-        means compression ratio will likely be worse when using
-        Commons Compress compared to the native 7z executable.</p>
-
-        <p>Reading or writing requires a
-        <code>SeekableByteChannel</code> that will be obtained
-        transparently when reading from or writing to a file. The
-        class
-        <code>org.apache.commons.compress.utils.SeekableInMemoryByteChannel</code>
-        allows you to read from or write to an in-memory archive.</p>
-
-        <p>Adding an entry to a 7z archive:</p>
-<source><![CDATA[
-SevenZOutputFile sevenZOutput = new SevenZOutputFile(file);
-SevenZArchiveEntry entry = sevenZOutput.createArchiveEntry(fileToArchive, name);
-sevenZOutput.putArchiveEntry(entry);
-sevenZOutput.write(contentOfEntry);
-sevenZOutput.closeArchiveEntry();
-]]></source>
-
-        <p>Uncompressing a given 7z archive (you would
-          certainly add exception handling and make sure all streams
-          get closed properly):</p>
-<source><![CDATA[
-SevenZFile sevenZFile = new SevenZFile(new File("archive.7z"));
-SevenZArchiveEntry entry = sevenZFile.getNextEntry();
-byte[] content = new byte[entry.getSize()];
-LOOP UNTIL entry.getSize() HAS BEEN READ {
-    sevenZFile.read(content, offset, content.length - offset);
-}
-]]></source>
-
-          <p>Uncompressing a given in-memory 7z archive:</p>
-          <source><![CDATA[
-byte[] inputData; // 7z archive contents
-SeekableInMemoryByteChannel inMemoryByteChannel = new SeekableInMemoryByteChannel(inputData);
-SevenZFile sevenZFile = new SevenZFile(inMemoryByteChannel);
-SevenZArchiveEntry entry = sevenZFile.getNextEntry();
-sevenZFile.read();  // read current entry's data
-]]></source>
-      </subsection>
-
-      <subsection name="arj">
-
-        <p>Note that Commons Compress doesn't support compressed,
-        encrypted or multi-volume ARJ archives, yet.</p>
-
-        <p>Uncompressing a given arj archive (you would
-          certainly add exception handling and make sure all streams
-          get closed properly):</p>
-<source><![CDATA[
-ArjArchiveEntry entry = arjInput.getNextEntry();
-byte[] content = new byte[entry.getSize()];
-LOOP UNTIL entry.getSize() HAS BEEN READ {
-    arjInput.read(content, offset, content.length - offset);
+     scatterZipCreator.writeTo(zipArchiveOutputStream);
+  }
 }
-]]></source>
+</source>
       </subsection>
 
     </section>
@@ -575,153 +575,128 @@ in.close();
 
       </subsection>
 
-      <subsection name="gzip">
+      <subsection name="DEFLATE">
 
         <p>The implementation of the DEFLATE/INFLATE code used by this
         package is provided by the <code>java.util.zip</code> package
         of the Java class library.</p>
 
-        <p>Uncompressing a given gzip compressed file (you would
+        <p>Uncompressing a given DEFLATE 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.gz"));
+InputStream fin = Files.newInputStream(Paths.get("some-file"));
 BufferedInputStream in = new BufferedInputStream(fin);
 OutputStream out = Files.newOutputStream(Paths.get("archive.tar"));
-GzipCompressorInputStream gzIn = new GzipCompressorInputStream(in);
+DeflateCompressorInputStream defIn = new DeflateCompressorInputStream(in);
 final byte[] buffer = new byte[buffersize];
 int n = 0;
-while (-1 != (n = gzIn.read(buffer))) {
+while (-1 != (n = defIn.read(buffer))) {
     out.write(buffer, 0, n);
 }
 out.close();
-gzIn.close();
+defIn.close();
 ]]></source>
 
-        <p>Compressing a given file using gzip (you would
+        <p>Compressing a given file using DEFLATE (you would
           certainly add exception handling and make sure all streams
           get closed properly):</p>
 <source><![CDATA[
 InputStream in = Files.newInputStream(Paths.get("archive.tar"));
-OutputStream fout = Files.newOutputStream(Paths.get("archive.tar.gz"));
+OutputStream fout = Files.newOutputStream(Paths.get("some-file"));
 BufferedOutputStream out = new BufferedOutputStream(fout);
-GzipCompressorOutputStream gzOut = new GzipCompressorOutputStream(out);
+DeflateCompressorOutputStream defOut = new DeflateCompressorOutputStream(out);
 final byte[] buffer = new byte[buffersize];
 int n = 0;
 while (-1 != (n = in.read(buffer))) {
-    gzOut.write(buffer, 0, n);
+    defOut.write(buffer, 0, n);
 }
-gzOut.close();
+defOut.close();
 in.close();
 ]]></source>
 
       </subsection>
 
-      <subsection name="Pack200">
-
-        <p>The Pack200 package has a <a href="pack200.html">dedicated
-          documentation page</a>.</p>
-
-        <p>The implementation of this package is provided by
-          the <code>java.util.zip</code> package of the Java class
-          library.</p>
+      <subsection name="DEFLATE64">
 
-        <p>Uncompressing a given pack200 compressed file (you would
+        <p>Uncompressing a given DEFLATE64 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.pack"));
+InputStream fin = Files.newInputStream(Paths.get("some-file"));
 BufferedInputStream in = new BufferedInputStream(fin);
-OutputStream out = Files.newOutputStream(Paths.get("archive.jar"));
-Pack200CompressorInputStream pIn = new Pack200CompressorInputStream(in);
+OutputStream out = Files.newOutputStream(Paths.get("archive.tar"));
+Deflate64CompressorInputStream defIn = new Deflate64CompressorInputStream(in);
 final byte[] buffer = new byte[buffersize];
 int n = 0;
-while (-1 != (n = pIn.read(buffer))) {
+while (-1 != (n = defIn.read(buffer))) {
     out.write(buffer, 0, n);
 }
 out.close();
-pIn.close();
-]]></source>
-
-        <p>Compressing a given jar using pack200 (you would
-          certainly add exception handling and make sure all streams
-          get closed properly):</p>
-<source><![CDATA[
-InputStream in = Files.newInputStream(Paths.get("archive.jar"));
-OutputStream fout = Files.newOutputStream(Paths.get("archive.pack"));
-BufferedOutputStream out = new BufferedInputStream(fout);
-Pack200CompressorOutputStream pOut = new Pack200CompressorOutputStream(out);
-final byte[] buffer = new byte[buffersize];
-int n = 0;
-while (-1 != (n = in.read(buffer))) {
-    pOut.write(buffer, 0, n);
-}
-pOut.close();
-in.close();
+defIn.close();
 ]]></source>
 
       </subsection>
 
-      <subsection name="XZ">
-
-        <p>The implementation of this package is provided by the
-          public domain <a href="https://tukaani.org/xz/java.html">XZ
-          for Java</a> library.</p>
+      <subsection name="gzip">
 
-        <p>When you try to open an XZ stream for reading using
-        <code>CompressorStreamFactory</code>, Commons Compress will
-        check whether the XZ for Java library is available.  Starting
-        with Compress 1.9 the result of this check will be cached
-        unless Compress finds OSGi classes in its classpath.  You can
-        use <code>XZUtils#setCacheXZAvailability</code> to overrride
-        this default behavior.</p>
+        <p>The implementation of the DEFLATE/INFLATE code used by this
+        package is provided by the <code>java.util.zip</code> package
+        of the Java class library.</p>
 
-        <p>Uncompressing a given XZ compressed file (you would
+        <p>Uncompressing a given gzip 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.xz"));
+InputStream fin = Files.newInputStream(Paths.get("archive.tar.gz"));
 BufferedInputStream in = new BufferedInputStream(fin);
 OutputStream out = Files.newOutputStream(Paths.get("archive.tar"));
-XZCompressorInputStream xzIn = new XZCompressorInputStream(in);
+GzipCompressorInputStream gzIn = new GzipCompressorInputStream(in);
 final byte[] buffer = new byte[buffersize];
 int n = 0;
-while (-1 != (n = xzIn.read(buffer))) {
+while (-1 != (n = gzIn.read(buffer))) {
     out.write(buffer, 0, n);
 }
 out.close();
-xzIn.close();
+gzIn.close();
 ]]></source>
 
-        <p>Compressing a given file using XZ (you would
+        <p>Compressing a given file using gzip (you would
           certainly add exception handling and make sure all streams
           get closed properly):</p>
 <source><![CDATA[
 InputStream in = Files.newInputStream(Paths.get("archive.tar"));
-OutputStream fout = Files.newOutputStream(Paths.get("archive.tar.xz"));
-BufferedOutputStream out = new BufferedInputStream(fout);
-XZCompressorOutputStream xzOut = new XZCompressorOutputStream(out);
+OutputStream fout = Files.newOutputStream(Paths.get("archive.tar.gz"));
+BufferedOutputStream out = new BufferedOutputStream(fout);
+GzipCompressorOutputStream gzOut = new GzipCompressorOutputStream(out);
 final byte[] buffer = new byte[buffersize];
 int n = 0;
 while (-1 != (n = in.read(buffer))) {
-    xzOut.write(buffer, 0, n);
+    gzOut.write(buffer, 0, n);
 }
-xzOut.close();
+gzOut.close();
 in.close();
 ]]></source>
 
       </subsection>
-      
-      <subsection name="Z">
 
-        <p>Uncompressing a given Z compressed file (you would
+      <subsection name="LZ4">
+
+        <p>There are two different "formats" used for <a
+        href="http://lz4.github.io/lz4/">lz4</a>. The format called
+        "block format" only contains the raw compressed data while the
+        other provides a higher level "frame format" - Commons
+        Compress offers two different stream classes for reading or
+        writing either format.</p>
+
+        <p>Uncompressing a given frame LZ4 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.Z"));
+InputStream fin = Files.newInputStream(Paths.get("archive.tar.lz4"));
 BufferedInputStream in = new BufferedInputStream(fin);
 OutputStream out = Files.newOutputStream(Paths.get("archive.tar"));
-ZCompressorInputStream zIn = new ZCompressorInputStream(in);
+FramedLZ4CompressorInputStream zIn = new FramedLZ4CompressorInputStream(in);
 final byte[] buffer = new byte[buffersize];
 int n = 0;
 while (-1 != (n = zIn.read(buffer))) {
@@ -731,6 +706,23 @@ out.close();
 zIn.close();
 ]]></source>
 
+        <p>Compressing a given file using the LZ4 frame format (you would
+          certainly add exception handling and make sure all streams
+          get closed properly):</p>
+<source><![CDATA[
+InputStream in = Files.newInputStream(Paths.get("archive.tar"));
+OutputStream fout = Files.newOutputStream(Paths.get("archive.tar.lz4"));
+BufferedOutputStream out = new BufferedOutputStream(fout);
+FramedLZ4CompressorOutputStream lzOut = new FramedLZ4CompressorOutputStream(out);
+final byte[] buffer = new byte[buffersize];
+int n = 0;
+while (-1 != (n = in.read(buffer))) {
+    lzOut.write(buffer, 0, n);
+}
+lzOut.close();
+in.close();
+]]></source>
+
       </subsection>
 
       <subsection name="lzma">
@@ -775,69 +767,51 @@ in.close();
 
       </subsection>
 
-      <subsection name="DEFLATE">
+      <subsection name="Pack200">
 
-        <p>The implementation of the DEFLATE/INFLATE code used by this
-        package is provided by the <code>java.util.zip</code> package
-        of the Java class library.</p>
+        <p>The Pack200 package has a <a href="pack200.html">dedicated
+          documentation page</a>.</p>
 
-        <p>Uncompressing a given DEFLATE compressed file (you would
+        <p>The implementation of this package is provided by
+          the <code>java.util.zip</code> package of the Java class
+          library.</p>
+
+        <p>Uncompressing a given pack200 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("some-file"));
+InputStream fin = Files.newInputStream(Paths.get("archive.pack"));
 BufferedInputStream in = new BufferedInputStream(fin);
-OutputStream out = Files.newOutputStream(Paths.get("archive.tar"));
-DeflateCompressorInputStream defIn = new DeflateCompressorInputStream(in);
+OutputStream out = Files.newOutputStream(Paths.get("archive.jar"));
+Pack200CompressorInputStream pIn = new Pack200CompressorInputStream(in);
 final byte[] buffer = new byte[buffersize];
 int n = 0;
-while (-1 != (n = defIn.read(buffer))) {
+while (-1 != (n = pIn.read(buffer))) {
     out.write(buffer, 0, n);
 }
 out.close();
-defIn.close();
+pIn.close();
 ]]></source>
 
-        <p>Compressing a given file using DEFLATE (you would
+        <p>Compressing a given jar using pack200 (you would
           certainly add exception handling and make sure all streams
           get closed properly):</p>
 <source><![CDATA[
-InputStream in = Files.newInputStream(Paths.get("archive.tar"));
-OutputStream fout = Files.newOutputStream(Paths.get("some-file"));
-BufferedOutputStream out = new BufferedOutputStream(fout);
-DeflateCompressorOutputStream defOut = new DeflateCompressorOutputStream(out);
+InputStream in = Files.newInputStream(Paths.get("archive.jar"));
+OutputStream fout = Files.newOutputStream(Paths.get("archive.pack"));
+BufferedOutputStream out = new BufferedInputStream(fout);
+Pack200CompressorOutputStream pOut = new Pack200CompressorOutputStream(out);
 final byte[] buffer = new byte[buffersize];
 int n = 0;
 while (-1 != (n = in.read(buffer))) {
-    defOut.write(buffer, 0, n);
+    pOut.write(buffer, 0, n);
 }
-defOut.close();
+pOut.close();
 in.close();
 ]]></source>
 
       </subsection>
 
-      <subsection name="DEFLATE64">
-
-        <p>Uncompressing a given DEFLATE64 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("some-file"));
-BufferedInputStream in = new BufferedInputStream(fin);
-OutputStream out = Files.newOutputStream(Paths.get("archive.tar"));
-Deflate64CompressorInputStream defIn = new Deflate64CompressorInputStream(in);
-final byte[] buffer = new byte[buffersize];
-int n = 0;
-while (-1 != (n = defIn.read(buffer))) {
-    out.write(buffer, 0, n);
-}
-out.close();
-defIn.close();
-]]></source>
-
-      </subsection>
-
       <subsection name="Snappy">
 
         <p>There are two different "formats" used for <a
@@ -892,50 +866,76 @@ in.close();
 
       </subsection>
 
-      <subsection name="LZ4">
+      <subsection name="XZ">
 
-        <p>There are two different "formats" used for <a
-        href="http://lz4.github.io/lz4/">lz4</a>. The format called
-        "block format" only contains the raw compressed data while the
-        other provides a higher level "frame format" - Commons
-        Compress offers two different stream classes for reading or
-        writing either format.</p>
+        <p>The implementation of this package is provided by the
+          public domain <a href="https://tukaani.org/xz/java.html">XZ
+          for Java</a> library.</p>
 
-        <p>Uncompressing a given frame LZ4 file (you would
+        <p>When you try to open an XZ stream for reading using
+        <code>CompressorStreamFactory</code>, Commons Compress will
+        check whether the XZ for Java library is available.  Starting
+        with Compress 1.9 the result of this check will be cached
+        unless Compress finds OSGi classes in its classpath.  You can
+        use <code>XZUtils#setCacheXZAvailability</code> to overrride
+        this default behavior.</p>
+
+        <p>Uncompressing a given XZ 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.lz4"));
+InputStream fin = Files.newInputStream(Paths.get("archive.tar.xz"));
 BufferedInputStream in = new BufferedInputStream(fin);
 OutputStream out = Files.newOutputStream(Paths.get("archive.tar"));
-FramedLZ4CompressorInputStream zIn = new FramedLZ4CompressorInputStream(in);
+XZCompressorInputStream xzIn = new XZCompressorInputStream(in);
 final byte[] buffer = new byte[buffersize];
 int n = 0;
-while (-1 != (n = zIn.read(buffer))) {
+while (-1 != (n = xzIn.read(buffer))) {
     out.write(buffer, 0, n);
 }
 out.close();
-zIn.close();
+xzIn.close();
 ]]></source>
 
-        <p>Compressing a given file using the LZ4 frame format (you would
+        <p>Compressing a given file using XZ (you would
           certainly add exception handling and make sure all streams
           get closed properly):</p>
 <source><![CDATA[
 InputStream in = Files.newInputStream(Paths.get("archive.tar"));
-OutputStream fout = Files.newOutputStream(Paths.get("archive.tar.lz4"));
-BufferedOutputStream out = new BufferedOutputStream(fout);
-FramedLZ4CompressorOutputStream lzOut = new FramedLZ4CompressorOutputStream(out);
+OutputStream fout = Files.newOutputStream(Paths.get("archive.tar.xz"));
+BufferedOutputStream out = new BufferedInputStream(fout);
+XZCompressorOutputStream xzOut = new XZCompressorOutputStream(out);
 final byte[] buffer = new byte[buffersize];
 int n = 0;
 while (-1 != (n = in.read(buffer))) {
-    lzOut.write(buffer, 0, n);
+    xzOut.write(buffer, 0, n);
 }
-lzOut.close();
+xzOut.close();
 in.close();
 ]]></source>
 
       </subsection>
+      
+      <subsection name="Z">
+
+        <p>Uncompressing a given Z 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.Z"));
+BufferedInputStream in = new BufferedInputStream(fin);
+OutputStream out = Files.newOutputStream(Paths.get("archive.tar"));
+ZCompressorInputStream zIn = new ZCompressorInputStream(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>
 
       <subsection name="Zstandard">