commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r742990 - in /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress: archivers/ar/ archivers/cpio/ archivers/tar/ archivers/zip/ compressors/ compressors/bzip2/ compressors/gzip/
Date Tue, 10 Feb 2009 15:11:59 GMT
Author: bodewig
Date: Tue Feb 10 15:11:22 2009
New Revision: 742990

URL: http://svn.apache.org/viewvc?rev=742990&view=rev
Log:
revert Filter*Stream patches since they do more harm than help

Modified:
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarOutputStream.java
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/CompressorInputStream.java
    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/BZip2CompressorInputStream.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/GzipCompressorInputStream.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/archivers/ar/ArArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java?rev=742990&r1=742989&r2=742990&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveOutputStream.java
Tue Feb 10 15:11:22 2009
@@ -146,6 +146,11 @@
         entryOffset += len;
     }
 
+    public void write(byte[] b) throws IOException {
+        out.write(b);
+        entryOffset += b.length;
+    }
+
     public void close() throws IOException {
         closeArchiveEntry();
         out.close();

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java?rev=742990&r1=742989&r2=742990&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
Tue Feb 10 15:11:22 2009
@@ -422,4 +422,10 @@
         this.putNextEntry((CpioArchiveEntry)entry);
     }
 
+    /* (non-Javadoc)
+     * @see java.io.OutputStream#write(int)
+     */
+    public void write(int b) throws IOException {
+        out.write(b);
+    }
 }

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarOutputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarOutputStream.java?rev=742990&r1=742989&r2=742990&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarOutputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarOutputStream.java
Tue Feb 10 15:11:22 2009
@@ -244,6 +244,18 @@
     }
 
     /**
+     * Writes bytes to the current tar archive entry.
+     *
+     * This method simply calls write( byte[], int, int ).
+     *
+     * @param wBuf The buffer to write to the archive.
+     * @throws IOException on error
+     */
+    public void write(byte[] wBuf) throws IOException {
+        write(wBuf, 0, wBuf.length);
+    }
+
+    /**
      * Writes bytes to the current tar archive entry. This method
      * is aware of the current entry and will throw an exception if
      * you attempt to write bytes past the length specified for the

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java?rev=742990&r1=742989&r2=742990&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
Tue Feb 10 15:11:22 2009
@@ -552,6 +552,19 @@
         }
     }
 
+    /**
+     * Flushes this output stream and forces any buffered output bytes
+     * to be written out to the stream.
+     *
+     * @exception  IOException  if an I/O error occurs.
+     * @since 1.14
+     */
+    public void flush() throws IOException {
+        if (out != null) {
+            out.flush();
+        }
+    }
+
     public void putArchiveEntry(ArchiveEntry entry) throws IOException {
         putNextEntry((ZipArchiveEntry) entry);
     }

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/CompressorInputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/CompressorInputStream.java?rev=742990&r1=742989&r2=742990&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/CompressorInputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/CompressorInputStream.java
Tue Feb 10 15:11:22 2009
@@ -18,12 +18,8 @@
  */
 package org.apache.commons.compress.compressors;
 
-import java.io.FilterInputStream;
 import java.io.InputStream;
 
-public abstract class CompressorInputStream extends FilterInputStream {
+public abstract class CompressorInputStream extends InputStream {
     // TODO 
-    protected CompressorInputStream(final InputStream i) {
-        super(i);
-    }
 }

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=742990&r1=742989&r2=742990&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 15:11:22 2009
@@ -18,12 +18,8 @@
  */
 package org.apache.commons.compress.compressors;
 
-import java.io.FilterOutputStream;
 import java.io.OutputStream;
 
-public abstract class CompressorOutputStream extends FilterOutputStream {
+public abstract class CompressorOutputStream extends OutputStream {
     // TODO
-    protected CompressorOutputStream(final OutputStream o) {
-        super(o);
-    }
 }

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java?rev=742990&r1=742989&r2=742990&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
Tue Feb 10 15:11:22 2009
@@ -80,6 +80,8 @@
 
     private int nInUse;
 
+    private InputStream in;
+
     private int currentChar = -1;
 
     private static final int EOF                  = 0;
@@ -130,8 +132,9 @@
      *  if <tt>in == null</tt>
      */
     public BZip2CompressorInputStream(final InputStream in) throws IOException {
-        super(in);
+        super();
 
+        this.in = in;
         init();
     }
 

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=742990&r1=742989&r2=742990&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 15:11:22 2009
@@ -272,7 +272,6 @@
 
     public BZip2CompressorOutputStream(OutputStream inStream, int inBlockSize)
         throws IOException {
-        super(inStream);
         block = null;
         quadrant = null;
         zptr = null;
@@ -378,7 +377,7 @@
         }
         finish();
         super.close();
-        out.close();
+        bsStream.close();
         closed = true;
     }
 
@@ -397,7 +396,7 @@
 
     public void flush() throws IOException {
         super.flush();
-        out.flush();
+        bsStream.flush();
     }
 
     private int blockCRC, combinedCRC;
@@ -517,7 +516,7 @@
     }
 
     private void bsSetStream(OutputStream f) {
-        out = f;
+        bsStream = f;
         bsLive = 0;
         bsBuff = 0;
         bytesOut = 0;
@@ -527,7 +526,7 @@
         while (bsLive > 0) {
             int ch = (bsBuff >> 24);
             try {
-                out.write(ch); // write 8-bit
+                bsStream.write(ch); // write 8-bit
             } catch (IOException e) {
                 throw  e;
             }
@@ -541,7 +540,7 @@
         while (bsLive >= 8) {
             int ch = (bsBuff >> 24);
             try {
-                out.write(ch); // write 8-bit
+                bsStream.write(ch); // write 8-bit
             } catch (IOException e) {
                 throw e;
             }
@@ -888,6 +887,8 @@
         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/GzipCompressorInputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java?rev=742990&r1=742989&r2=742990&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java
Tue Feb 10 15:11:22 2009
@@ -26,8 +26,14 @@
 
 public class GzipCompressorInputStream extends CompressorInputStream {
 
+    private final GZIPInputStream in; 
+
     public GzipCompressorInputStream(InputStream inputStream) throws IOException {
-        super(new GZIPInputStream(inputStream));
+        in = new GZIPInputStream(inputStream);
+    }
+
+    public int read() throws IOException {
+        return in.read();
     }
 
 }

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=742990&r1=742989&r2=742990&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 15:11:22 2009
@@ -26,8 +26,18 @@
 
 public class GzipCompressorOutputStream extends CompressorOutputStream {
 
+    private final GZIPOutputStream out;
+
     public GzipCompressorOutputStream( final OutputStream outputStream ) throws IOException
{
-        super(new GZIPOutputStream(outputStream));
+        out = new GZIPOutputStream(outputStream);
+    }
+
+    public void write(int b) throws IOException {
+        out.write(b);
+    }
+
+    public void close() throws IOException {
+        out.close();
     }
 
 }



Mime
View raw message