commons-commits mailing list archives

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

URL: http://svn.apache.org/viewvc?rev=742997&view=rev
Log:
no longer extende FilterOutputStream in ArchiveOutputStream

Modified:
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveOutputStream.java
    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/TarArchiveOutputStream.java
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveOutputStream.java?rev=742997&r1=742996&r2=742997&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveOutputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveOutputStream.java
Tue Feb 10 15:35:35 2009
@@ -19,14 +19,9 @@
 package org.apache.commons.compress.archivers;
 
 import java.io.IOException;
-import java.io.FilterOutputStream;
 import java.io.OutputStream;
 
-public abstract class ArchiveOutputStream extends FilterOutputStream {
-
-    protected ArchiveOutputStream(OutputStream other) {
-        super(other);
-    }
+public abstract class ArchiveOutputStream extends OutputStream {
 
     public abstract void putArchiveEntry(ArchiveEntry entry) throws IOException;
 

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=742997&r1=742996&r2=742997&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:35:35 2009
@@ -26,12 +26,13 @@
 
 public class ArArchiveOutputStream extends ArchiveOutputStream {
 
+    private final OutputStream out;
     private long archiveOffset = 0;
     private long entryOffset = 0;
     private ArArchiveEntry prevEntry;
 
     public ArArchiveOutputStream( final OutputStream pOut ) {
-        super(pOut);
+        this.out = pOut;
     }
 
     private long writeArchiveHeader() throws IOException {

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=742997&r1=742996&r2=742997&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:35:35 2009
@@ -70,6 +70,8 @@
 
     private long written;
 
+    private final OutputStream out;
+
     /**
      * Check to make sure that this stream has not been closed
      *
@@ -88,7 +90,7 @@
      * @param format The format of the stream
      */
     public CpioArchiveOutputStream(final OutputStream out, final short format) {
-        super(out);
+        this.out = new FilterOutputStream(out);
         setFormat(format);
     }
 

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java?rev=742997&r1=742996&r2=742997&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
Tue Feb 10 15:35:35 2009
@@ -26,8 +26,10 @@
 
 public class TarArchiveOutputStream extends ArchiveOutputStream {
 
+    private final TarOutputStream out;
+    
     public TarArchiveOutputStream(OutputStream out) {
-        super(new TarOutputStream(out));
+        this.out = new TarOutputStream(out);
     }
     
     public void close() throws IOException {
@@ -35,11 +37,11 @@
     }
 
     public void closeArchiveEntry() throws IOException {
-        ((TarOutputStream) out).closeEntry();
+        this.out.closeEntry();
     }
 
     public void putArchiveEntry(ArchiveEntry entry) throws IOException {
-        ((TarOutputStream) out).putNextEntry((TarArchiveEntry)entry);
+        this.out.putNextEntry((TarArchiveEntry)entry);
     }
 
     public void write(byte[] buffer, int offset, int length) throws IOException {

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=742997&r1=742996&r2=742997&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:35:35 2009
@@ -246,13 +246,15 @@
      */
     private RandomAccessFile raf = null;
 
+    private final OutputStream out;
+
     /**
      * Creates a new ZIP OutputStream filtering the underlying stream.
      * @param out the outputstream to zip
      * @since 1.1
      */
     public ZipArchiveOutputStream(OutputStream out) {
-        super(out);
+        this.out = out;
     }
 
     /**
@@ -263,8 +265,7 @@
      * @throws IOException on error
      */
     public ZipArchiveOutputStream(File file) throws IOException {
-        super(null);
-
+        OutputStream o = null;
         try {
             raf = new RandomAccessFile(file, "rw");
             raf.setLength(0);
@@ -277,8 +278,9 @@
                 }
                 raf = null;
             }
-            out = new FileOutputStream(file);
+            o = new FileOutputStream(file);
         }
+        out = o;
     }
 
     /**
@@ -573,6 +575,14 @@
         // do nothing
     }
 
+    // used to be implemented via FilterOutputStream
+    /**
+     * Invokes the {@see #write(byte[],int,int) three-arg version}.
+     */
+    public void write(byte[] b) throws IOException {
+        write(b, 0, b.length);
+    }
+
     /*
      * Various ZIP constants
      */



Mime
View raw message