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 2009/08/01 22:17:00 UTC

svn commit: r799917 - in /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip: GzipCompressorInputStream.java GzipCompressorOutputStream.java

Author: bodewig
Date: Sat Aug  1 20:17:00 2009
New Revision: 799917

URL: http://svn.apache.org/viewvc?rev=799917&view=rev
Log:
delegate all read/write methods in gzip streams.  COMPRESS-83

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java?rev=799917&r1=799916&r2=799917&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java (original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java Sat Aug  1 20:17:00 2009
@@ -47,7 +47,26 @@
      * @see java.io.InputStream#read()
      */
     public int read() throws IOException {
-        this.count(1);
-        return in.read();
+        int read = in.read();
+        this.count(read < 0 ? -1 : 1);
+        return read;
+    }
+
+    /* (non-Javadoc)
+     * @see java.io.InputStream#read(byte[])
+     */
+    public int read(byte[] b) throws IOException {
+        int read = in.read(b);
+        this.count(read);
+        return read;
+    }
+
+    /* (non-Javadoc)
+     * @see java.io.InputStream#read(byte[], int, int)
+     */
+    public int read(byte[] b, int from, int length) throws IOException {
+        int read = in.read(b, from, length);
+        this.count(read);
+        return read;
     }
 }

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java?rev=799917&r1=799916&r2=799917&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java (original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java Sat Aug  1 20:17:00 2009
@@ -36,6 +36,14 @@
         out.write(b);
     }
 
+    public void write(byte[] b) throws IOException {
+        out.write(b);
+    }
+
+    public void write(byte[] b, int from, int length) throws IOException {
+        out.write(b, from, length);
+    }
+
     public void close() throws IOException {
         out.close();
     }