commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r742985 - in /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors: CompressorOutputStream.java bzip2/BZip2CompressorOutputStream.java gzip/GzipCompressorOutputStream.java
Date Tue, 10 Feb 2009 14:45:27 GMT
Author: bodewig
Date: Tue Feb 10 14:45:08 2009
New Revision: 742985

URL: http://svn.apache.org/viewvc?rev=742985&view=rev
Log:
Make CompressorOutputStream extend FilterStream

Modified:
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/CompressorOutputStream.java
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/CompressorOutputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/CompressorOutputStream.java?rev=742985&r1=742984&r2=742985&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/CompressorOutputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/CompressorOutputStream.java
Tue Feb 10 14:45:08 2009
@@ -18,8 +18,12 @@
  */
 package org.apache.commons.compress.compressors;
 
+import java.io.FilterOutputStream;
 import java.io.OutputStream;
 
-public abstract class CompressorOutputStream extends OutputStream {
+public abstract class CompressorOutputStream extends FilterOutputStream {
     // TODO
+    protected CompressorOutputStream(final OutputStream o) {
+        super(o);
+    }
 }

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java?rev=742985&r1=742984&r2=742985&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorOutputStream.java
Tue Feb 10 14:45:08 2009
@@ -272,6 +272,7 @@
 
     public BZip2CompressorOutputStream(OutputStream inStream, int inBlockSize)
         throws IOException {
+        super(inStream);
         block = null;
         quadrant = null;
         zptr = null;
@@ -377,7 +378,7 @@
         }
         finish();
         super.close();
-        bsStream.close();
+        out.close();
         closed = true;
     }
 
@@ -396,7 +397,7 @@
 
     public void flush() throws IOException {
         super.flush();
-        bsStream.flush();
+        out.flush();
     }
 
     private int blockCRC, combinedCRC;
@@ -516,7 +517,7 @@
     }
 
     private void bsSetStream(OutputStream f) {
-        bsStream = f;
+        out = f;
         bsLive = 0;
         bsBuff = 0;
         bytesOut = 0;
@@ -526,7 +527,7 @@
         while (bsLive > 0) {
             int ch = (bsBuff >> 24);
             try {
-                bsStream.write(ch); // write 8-bit
+                out.write(ch); // write 8-bit
             } catch (IOException e) {
                 throw  e;
             }
@@ -540,7 +541,7 @@
         while (bsLive >= 8) {
             int ch = (bsBuff >> 24);
             try {
-                bsStream.write(ch); // write 8-bit
+                out.write(ch); // write 8-bit
             } catch (IOException e) {
                 throw e;
             }
@@ -887,8 +888,6 @@
         sendMTFValues();
     }
 
-    private OutputStream bsStream;
-
     private void simpleSort(int lo, int hi, int d) {
         int i, j, h, bigN, hp;
         int v;

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java?rev=742985&r1=742984&r2=742985&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java
Tue Feb 10 14:45:08 2009
@@ -26,18 +26,8 @@
 
 public class GzipCompressorOutputStream extends CompressorOutputStream {
 
-    private final GZIPOutputStream out;
-
     public GzipCompressorOutputStream( final OutputStream outputStream ) throws IOException
{
-        out = new GZIPOutputStream(outputStream);
-    }
-
-    public void write(int b) throws IOException {
-        out.write(b);
-    }
-
-    public void close() throws IOException {
-        out.close();
+        super(new GZIPOutputStream(outputStream));
     }
 
 }



Mime
View raw message