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 2019/11/07 16:19:04 UTC

[commons-compress] branch master updated (c7a9079 -> 28049d2)

This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git.


    from c7a9079  Merge pull request #83 from PeterAlfreadLee/random_access_of_7z
     new 228e739  COMPRESS-342 record changes - see #83
     new 28049d2  boy scout fixes

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/changes/changes.xml                               |  4 ++++
 .../commons/compress/archivers/sevenz/SevenZFile.java | 19 ++++++++++++++++---
 src/site/xdoc/examples.xml                            | 10 ++++++++++
 src/site/xdoc/index.xml                               | 13 +++----------
 src/site/xdoc/limitations.xml                         |  4 ++--
 5 files changed, 35 insertions(+), 15 deletions(-)


[commons-compress] 02/02: boy scout fixes

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git

commit 28049d2f89a76c5a4845c12151a483ca7773fb6f
Author: Stefan Bodewig <bo...@apache.org>
AuthorDate: Thu Nov 7 17:18:36 2019 +0100

    boy scout fixes
---
 src/site/xdoc/limitations.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/site/xdoc/limitations.xml b/src/site/xdoc/limitations.xml
index 1dbe1f2..ada85ab 100644
--- a/src/site/xdoc/limitations.xml
+++ b/src/site/xdoc/limitations.xml
@@ -53,13 +53,13 @@
          archives, starting with 1.8 it will throw a
          <code>StreamingNotSupportedException</code> when reading from
          a 7z archive.</li>
-         <li>Encryption, solid compression and header compression and
+         <li>Encryption, solid compression and header compression
          are only supported when reading archives</li>
          <li>Commons Compress 1.12 and earlier didn't support writing
          LZMA.</li>
          <li>Several of the "methods" supported by 7z are not
          implemented in Compress.</li>
-         <li>No support for writing multi-volume archives Such
+         <li>No support for writing multi-volume archives. Such
          archives can be read by simply concatenating the parts, for
          example by using
          <code>MultiReadOnlySeekableByteChannel</code>.</li>


[commons-compress] 01/02: COMPRESS-342 record changes - see #83

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git

commit 228e73995ea16cb247e5549fed727edfc3a28dce
Author: Stefan Bodewig <bo...@apache.org>
AuthorDate: Thu Nov 7 17:18:14 2019 +0100

    COMPRESS-342 record changes - see #83
---
 src/changes/changes.xml                               |  4 ++++
 .../commons/compress/archivers/sevenz/SevenZFile.java | 19 ++++++++++++++++---
 src/site/xdoc/examples.xml                            | 10 ++++++++++
 src/site/xdoc/index.xml                               | 13 +++----------
 4 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index abf85e6..ec4b18a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -70,6 +70,10 @@ The <action> type attribute can be add,update,fix,remove.
         SevenZFile can now revover from a certain corruption that
         seems to happen occasinally when split archives are created.
       </action>
+      <action issue="COMPRESS-342" type="update" date="2019-11-07"
+              due-to="Peter Alfred Lee">
+        Added random access support to SevenZFile.
+      </action>
     </release>
     <release version="1.19" date="2019-08-27"
              description="Release 1.19
diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
index b73cf5c..0e7f0ec 100644
--- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
+++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
@@ -1320,15 +1320,28 @@ public class SevenZFile implements Closeable {
         return deferredBlockStreams.get(0);
     }
 
+    /**
+     * Returns an InputStream for reading the contents of the given entry.
+     *
+     * <p>For archives using solid compression randomly accessing
+     * entries will be significantly slower than reading the archive
+     * sequentiallly.</p>
+     *
+     * @param entry the entry to get the stream for.
+     * @return a stream to read the entry from.
+     * @throws IOException if unable to create an input stream from the zipentry
+     * @since Compress 1.20
+     */
     public InputStream getInputStream(SevenZArchiveEntry entry) throws IOException {
         int entryIndex = -1;
-        for(int i = 0; i < this.archive.files.length;i++) {
-            if(entry == this.archive.files[i]) {
+        for (int i = 0; i < this.archive.files.length;i++) {
+            if (entry == this.archive.files[i]) {
                 entryIndex = i;
+                break;
             }
         }
 
-        if(entryIndex < 0) {
+        if (entryIndex < 0) {
             throw new IllegalArgumentException("Can not find " + entry.getName() + " in " + this.fileName);
         }
 
diff --git a/src/site/xdoc/examples.xml b/src/site/xdoc/examples.xml
index 488bbb5..957294e 100644
--- a/src/site/xdoc/examples.xml
+++ b/src/site/xdoc/examples.xml
@@ -420,6 +420,16 @@ LOOP UNTIL entry.getSize() HAS BEEN READ {
 }
 ]]></source>
 
+        <h4><a name="Random-Access to 7z Archives"></a>Random-Access to 7z Archives</h4>
+
+        <p>Prior to Compress 1.20 7z archives could only be read
+        sequentially. The
+        <code>getInputStream(SevenZArchiveEntry)</code> method
+        introduced with Compress 1.20 now provides random access but
+        at least when the archive uses solid compression random access
+        will likely be significantly slower than sequential
+        access.</p>
+
       </subsection>
 
       <subsection name="ar">
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index 18709b4..8b57f03 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -58,17 +58,10 @@
           of changes see the <a href="changes-report.html">Changes
           Report</a>.</p>
 
-          <subsection name="What's new in 1.19?">
+          <subsection name="What's new in 1.20?">
             <ul>
-              <li><code>ParallelScatterZipCreator</code> now writes
-              entries in the same order they have been added to the
-              archive.</li>
-              <li><code>ZipArchiveInputStream</code> and
-              <code>ZipFile</code> are more forgiving when parsing
-              extra fields by default now.</li>
-              <li><code>TarArchiveInputStream</code> has a new lenient
-              mode that may allow it to read certain broken
-              archives.</li>
+              <li><code>SevenZFile</code> now supports random
+              access.</li>
             </ul>
           </subsection>
         </section>