commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1532294 - in /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress: archivers/sevenz/SevenZFile.java compressors/lzma/LZMACompressorInputStream.java
Date Tue, 15 Oct 2013 11:53:16 GMT
Author: bodewig
Date: Tue Oct 15 11:53:16 2013
New Revision: 1532294

URL: http://svn.apache.org/r1532294
Log:
cosmetic improvements

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/lzma/LZMACompressorInputStream.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java?rev=1532294&r1=1532293&r2=1532294&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
Tue Oct 15 11:53:16 2013
@@ -63,6 +63,9 @@ import org.apache.commons.compress.utils
  */
 public class SevenZFile {
     static final int SIGNATURE_HEADER_SIZE = 32;
+
+    private static final int DRAIN_BUF_SIZE = 64 * 1024;
+
     private RandomAccessFile file;
     private final Archive archive;
     private int currentEntryIndex = -1;
@@ -181,6 +184,7 @@ public class SevenZFile {
         }
         if (nid == NID.kHeader) {
             readHeader(nextHeaderInputStream, archive);
+            nextHeaderInputStream.close();
         } else {
             throw new IOException("Broken or unsupported archive: no Header");
         }
@@ -815,7 +819,7 @@ public class SevenZFile {
     
     private void drainPreviousEntry() throws IOException {
         if (currentEntryInputStream != null) {
-            final byte[] buffer = new byte[64*1024];
+            final byte[] buffer = new byte[DRAIN_BUF_SIZE];
             while (currentEntryInputStream.read(buffer) >= 0) { // NOPMD
             }
             currentEntryInputStream.close();

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/lzma/LZMACompressorInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/lzma/LZMACompressorInputStream.java?rev=1532294&r1=1532293&r2=1532294&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/lzma/LZMACompressorInputStream.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/lzma/LZMACompressorInputStream.java
Tue Oct 15 11:53:16 2013
@@ -52,7 +52,7 @@ public class LZMACompressorInputStream e
     @Override
     public int read() throws IOException {
         int ret = in.read();
-        count(ret == -1 ? -1 : 1);
+        count(ret == -1 ? 0 : 1);
         return ret;
     }
 



Mime
View raw message