commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1649374 - in /commons/proper/compress/trunk/src: main/java/org/apache/commons/compress/archivers/zip/ test/java/org/apache/commons/compress/archivers/zip/
Date Sun, 04 Jan 2015 17:35:46 GMT
Author: krosenvold
Date: Sun Jan  4 17:35:46 2015
New Revision: 1649374

URL: http://svn.apache.org/r1649374
Log:
Renamed method to getBytesWrittenForLastEntry

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/StreamCompressorTest.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java?rev=1649374&r1=1649373&r2=1649374&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ScatterZipOutputStream.java
Sun Jan  4 17:35:46 2015
@@ -89,7 +89,7 @@ public class ScatterZipOutputStream impl
     public void addArchiveEntry(ZipArchiveEntry zipArchiveEntry, InputStream payload, int
method) throws IOException {
         streamCompressor.deflate(payload, method);
         items.add(new CompressedEntry(zipArchiveEntry, streamCompressor.getCrc32(),
-                                      streamCompressor.getBytesWritten(), method,
+                                      streamCompressor.getBytesWrittenForLastEntry(), method,
                                       streamCompressor.getBytesRead()));
     }
 

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java?rev=1649374&r1=1649373&r2=1649374&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/StreamCompressor.java
Sun Jan  4 17:35:46 2015
@@ -46,7 +46,7 @@ public abstract class StreamCompressor i
 
     private final CRC32 crc = new CRC32();
 
-    private long writtenToOutputStream = 0;
+    private long writtenToOutputStreamForLastEntry = 0;
     private long sourcePayloadLength = 0;
     private long totalWrittenToOutputStream = 0;
 
@@ -132,12 +132,12 @@ public abstract class StreamCompressor i
     }
 
     /**
-     * The number of bytes written to the output
+     * The number of bytes written to the output for the last entry
      *
      * @return The number of bytes, never negative
      */
-    public long getBytesWritten() {
-        return writtenToOutputStream;
+    public long getBytesWrittenForLastEntry() {
+        return writtenToOutputStreamForLastEntry;
     }
 
     /**
@@ -181,7 +181,7 @@ public abstract class StreamCompressor i
      * @throws IOException on error
      */
     long write(byte[] b, int offset, int length, int method) throws IOException {
-        long current = writtenToOutputStream;
+        long current = writtenToOutputStreamForLastEntry;
         crc.update(b, offset, length);
         if (method == ZipArchiveEntry.DEFLATED) {
             writeDeflated(b, offset, length);
@@ -189,7 +189,7 @@ public abstract class StreamCompressor i
             writeCounted(b, offset, length);
         }
         sourcePayloadLength += length;
-        return writtenToOutputStream - current;
+        return writtenToOutputStreamForLastEntry - current;
     }
 
 
@@ -197,7 +197,7 @@ public abstract class StreamCompressor i
         crc.reset();
         def.reset();
         sourcePayloadLength = 0;
-        writtenToOutputStream = 0;
+        writtenToOutputStreamForLastEntry = 0;
     }
 
     public void close() throws IOException {
@@ -252,7 +252,7 @@ public abstract class StreamCompressor i
 
     public void writeCounted(byte[] data, int offset, int length) throws IOException {
         writeOut(data, offset, length);
-        writtenToOutputStream += length;
+        writtenToOutputStreamForLastEntry += length;
         totalWrittenToOutputStream += length;
     }
 

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/StreamCompressorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/StreamCompressorTest.java?rev=1649374&r1=1649373&r2=1649374&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/StreamCompressorTest.java
(original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/StreamCompressorTest.java
Sun Jan  4 17:35:46 2015
@@ -35,7 +35,7 @@ public class StreamCompressorTest {
         sc.deflate(new ByteArrayInputStream("A".getBytes()), ZipEntry.STORED);
         sc.deflate(new ByteArrayInputStream("BAD".getBytes()), ZipEntry.STORED);
         assertEquals(3, sc.getBytesRead());
-        assertEquals(3, sc.getBytesWritten());
+        assertEquals(3, sc.getBytesWrittenForLastEntry());
         assertEquals(344750961, sc.getCrc32());
         sc.deflate(new ByteArrayInputStream("CAFE".getBytes()), ZipEntry.STORED);
         assertEquals("ABADCAFE", baos.toString());
@@ -47,7 +47,7 @@ public class StreamCompressorTest {
         StreamCompressor sc = StreamCompressor.create( baos);
         sc.deflate(new ByteArrayInputStream("AAAAAABBBBBB".getBytes()), ZipEntry.DEFLATED);
         assertEquals(12, sc.getBytesRead());
-        assertEquals(8, sc.getBytesWritten());
+        assertEquals(8, sc.getBytesWrittenForLastEntry());
         assertEquals(3299542, sc.getCrc32());
 
         final byte[] actuals = baos.toByteArray();



Mime
View raw message