Repository: commons-compress
Updated Branches:
  refs/heads/master 7e35f57ae -> 57511f57d


COMPRESS-327 update documentation


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

Branch: refs/heads/master
Commit: 57511f57d8ec53663f3ad964582431d6e9c00d9e
Parents: 7e35f57
Author: Stefan Bodewig <bode...@apache.org>
Authored: Wed Oct 12 22:11:05 2016 +0200
Committer: Stefan Bodewig <bode...@apache.org>
Committed: Wed Oct 12 22:11:05 2016 +0200

----------------------------------------------------------------------
 src/changes/changes.xml                         |  5 ++++
 .../archivers/zip/ZipArchiveOutputStream.java   |  6 ++---
 src/site/xdoc/examples.xml                      |  7 +++---
 src/site/xdoc/index.xml                         | 11 +++++++--
 src/site/xdoc/limitations.xml                   |  6 +++--
 src/site/xdoc/zip.xml                           | 24 +++++++++++---------
 6 files changed, 38 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/57511f57/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 1bf494a..e195eed 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -61,6 +61,11 @@ The <action> type attribute can be add,update,fix,remove.
         ZipArchiveInputStream.closeEntry does not properly advance to
         next entry if there are junk bytes at end of data section
       </action>
+      <action issue="COMPRESS-327" type="add" date="2016-10-12">
+        SevenZFile, SevenZOutputFile, ZipFile and
+        ZipArchiveOutputStream can now work on non-file resources if
+        they can be accessed via SeekableByteChannel.
+      </action>
     </release>
     <release version="1.12" date="2016-06-21"
              description="Release 1.12 - API compatible to 1.11 but requires 
Java 6 at runtime.

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/57511f57/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
 
b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
index 22e924e..71a9267 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
@@ -622,7 +622,7 @@ public class ZipArchiveOutputStream extends 
ArchiveOutputStream {
                                        + " instead of "
                                        + bytesWritten);
             }
-        } else { /* method is STORED and we used RandomAccessFile */
+        } else { /* method is STORED and we used SeekableByteChannel */
             entry.entry.setSize(bytesWritten);
             entry.entry.setCompressedSize(bytesWritten);
             entry.entry.setCrc(crc);
@@ -752,7 +752,7 @@ public class ZipArchiveOutputStream extends 
ArchiveOutputStream {
             final Zip64ExtendedInformationExtraField z64 = 
getZip64Extra(entry.entry);
 
             // just a placeholder, real data will be in data
-            // descriptor or inserted later via RandomAccessFile
+            // descriptor or inserted later via SeekableByteChannel
             ZipEightByteInteger size = ZipEightByteInteger.ZERO;
             ZipEightByteInteger compressedSize = ZipEightByteInteger.ZERO;
             if (phased){
@@ -798,7 +798,7 @@ public class ZipArchiveOutputStream extends 
ArchiveOutputStream {
      */
     private void validateSizeInformation(final Zip64Mode effectiveMode)
         throws ZipException {
-        // Size/CRC not required if RandomAccessFile is used
+        // Size/CRC not required if SeekableByteChannel is used
         if (entry.entry.getMethod() == STORED && channel == null) {
             if (entry.entry.getSize() == ArchiveEntry.SIZE_UNKNOWN) {
                 throw new ZipException("uncompressed size is required for"

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/57511f57/src/site/xdoc/examples.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/examples.xml b/src/site/xdoc/examples.xml
index 8840968..be23e6b 100644
--- a/src/site/xdoc/examples.xml
+++ b/src/site/xdoc/examples.xml
@@ -262,10 +262,11 @@ zipOutput.closeArchiveEntry();
 ]]></source>
 
         <p><code>ZipArchiveOutputStream</code> can use some internal
-          optimizations exploiting <code>RandomAccessFile</code> if it
-          knows it is writing to a file rather than a non-seekable
+          optimizations exploiting <code>SeekableByteChannel</code> if it
+          knows it is writing to a seekable output rather than a non-seekable
           stream.  If you are writing to a file, you should use the
-          constructor that accepts a <code>File</code> argument rather
+          constructor that accepts a <code>File</code> or
+          <code>SeekableByteChannel</code> argument rather
           than the one using an <code>OutputStream</code> or the
           factory method in <code>ArchiveStreamFactory</code>.</p>
 

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/57511f57/src/site/xdoc/index.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index bde5915..6ed0c33 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -70,10 +70,17 @@
             </ul>
           </subsection>
 
-          <!--subsection name="What's coming in 1.13?">
+          <subsection name="What's coming in 1.13?">
             <ul>
+              <li>The 7z package as well as
+              <code>ZipArchiveOutputStream</code> and
+              <code>ZipFile</code> can now use
+              <code>SeekableByteChannel</code> when random acces is
+              needed. This allows archives to be read from inputs and
+              written to outputs that are seekable but are not
+              represented by <code>File</code>s.</li>
             </ul>
-          </subsection-->
+          </subsection>
         </section>
 
         <section name="Documentation">

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/57511f57/src/site/xdoc/limitations.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/limitations.xml b/src/site/xdoc/limitations.xml
index aa5f6af..5a661fd 100644
--- a/src/site/xdoc/limitations.xml
+++ b/src/site/xdoc/limitations.xml
@@ -31,7 +31,9 @@
          href="http://tukaani.org/xz/java.html";>XZ for Java</a>
          library.</li>
          <li>only <code>File</code>s are supported as input/output,
-         not streams.  In Compress 1.7
+         not streams. Starting with Compress 1.13
+         <code>SeekableByteChannel</code> is supported as well.</li>
+         <li>In Compress 1.7
          <code>ArchiveStreamFactory</code> will not auto-detect 7z
          archives, starting with 1.8 it will throw a
          <code>StreamingNotSupportedException</code> when reading from
@@ -168,7 +170,7 @@
          <li><code>ZipArchiveEntry#getLastModifiedDate</code> uses
          <code>ZipEntry#getTime</code> under the covers which may
          return different times for the same archive when using
-         different versions onf Java.</li>
+         different versions of Java.</li>
        </ul>
      </section>
    </body>

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/57511f57/src/site/xdoc/zip.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/zip.xml b/src/site/xdoc/zip.xml
index c280aca..558e8ea 100644
--- a/src/site/xdoc/zip.xml
+++ b/src/site/xdoc/zip.xml
@@ -107,15 +107,16 @@
       </subsection>
 
       <subsection name="ZipArchiveOutputStream" id="ZipArchiveOutputStream">
-        <p><code>ZipArchiveOutputStream</code> has two constructors,
-          one of them uses a <code>File</code> argument, the other
-          uses an <code>OutputStream</code>.  The <code>File</code>
-          version will try to use <code>RandomAccessFile</code> and
-          fall back to using a <code>FileOutputStream</code>
-          internally if that fails.</p>
+        <p><code>ZipArchiveOutputStream</code> has three constructors,
+        one of them uses a <code>File</code> argument, one a
+        <code>SeekableByteChannel</code> and the last uses an
+        <code>OutputStream</code>.  The <code>File</code> version will
+        try to use <code>SeekableByteChannel</code> and fall back to
+        using a <code>FileOutputStream</code> internally if that
+        fails.</p>
 
         <p>If <code>ZipArchiveOutputStream</code> can
-          use <code>RandomAccessFile</code> it can employ some
+          use <code>SeekableByteChannel</code> it can employ some
           optimizations that lead to smaller archives.  It also makes
           it possible to add uncompressed (<code>setMethod</code> used
           with <code>STORED</code>) entries of unknown size when
@@ -124,7 +125,8 @@
           an <code>OutputStream</code>.</p>
 
         <p>If you know you are writing to a file, you should always
-          prefer the <code>File</code>-arg constructor.</p>
+        prefer the <code>File</code>- or
+        <code>SeekableByteChannel</code>-arg constructors.</p>
       </subsection>
 
       <subsection name="Extra Fields">
@@ -331,7 +333,7 @@
           uncompressed sizes of the entry are known
           when <code>putArchiveEntry</code> is called
           or <code>ZipArchiveOutputStream</code>
-          uses <code>RandomAccessFile</code>
+          uses <code>SeekableByteChannel</code>
           (see <a href="#ZipArchiveOutputStream">above</a>).  If only
           the uncompressed size is
           known <code>ZipArchiveOutputStream</code> will assume the
@@ -375,7 +377,7 @@
           the format's limits is exceeded.  Archives created in this
           mode will be readable by all unarchivers; they may be
           slightly smaller than archives created
-          with <code>RandomAccessFile</code>
+          with <code>SeekableByteChannel</code>
           in <code>Zip64Mode.AsNeeded</code> mode if some of the
           entries had unknown sizes.</p>
 
@@ -391,7 +393,7 @@
           reached because Apache Commons Compress' own API
           (<code>ArchiveEntry</code>'s size information uses
           a <code>long</code>) or its usage of Java collections
-          or <code>RandomAccessFile</code> internally.  The table
+          or <code>SeekableByteChannel</code> internally.  The table
           below shows the theoretical limits supported by Apache
           Commons Compress.  In practice it is very likely that you'd
           run out of memory or your file system won't allow files that

Reply via email to