commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r741641 - in /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers: ./ ar/ cpio/ jar/ tar/ zip/
Date Fri, 06 Feb 2009 17:24:02 GMT
Author: bodewig
Date: Fri Feb  6 17:24:01 2009
New Revision: 741641

URL: http://svn.apache.org/viewvc?rev=741641&view=rev
Log:
merge ZipArchiveOutputStream and ZipOutputStream

Removed:
    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
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.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/jar/JarArchiveOutputStream.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/ZipOutputStream.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=741641&r1=741640&r2=741641&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
Fri Feb  6 17:24:01 2009
@@ -19,11 +19,16 @@
 package org.apache.commons.compress.archivers;
 
 import java.io.IOException;
+import java.io.FilterOutputStream;
 import java.io.OutputStream;
 
-public abstract class ArchiveOutputStream extends OutputStream {
+public abstract class ArchiveOutputStream extends FilterOutputStream {
 
-	public abstract void putArchiveEntry(ArchiveEntry entry) throws IOException;
+    protected ArchiveOutputStream(OutputStream other) {
+        super(other);
+    }
+
+    public abstract void putArchiveEntry(ArchiveEntry entry) throws IOException;
 	
     public abstract void closeArchiveEntry() throws IOException;
 }

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java?rev=741641&r1=741640&r2=741641&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ArchiveStreamFactory.java
Fri Feb  6 17:24:01 2009
@@ -31,7 +31,7 @@
 import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
 import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
 import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
-import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
+import org.apache.commons.compress.archivers.zip.ZipOutputStream;
 
 /**
  * Factory to create Archive[In|Out]putStreams from names
@@ -65,7 +65,7 @@
         if ("ar".equalsIgnoreCase(archiverName)) {
             return new ArArchiveOutputStream(out);
         } else if("zip".equalsIgnoreCase(archiverName)) {
-            return new ZipArchiveOutputStream(out);
+            return new ZipOutputStream(out);
         } else if("tar".equalsIgnoreCase(archiverName)) {
             return new TarArchiveOutputStream(out);
         } else if("jar".equalsIgnoreCase(archiverName)) {

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=741641&r1=741640&r2=741641&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
Fri Feb  6 17:24:01 2009
@@ -26,13 +26,12 @@
 
 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 ) {
-		out = pOut;	
+            super(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=741641&r1=741640&r2=741641&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
Fri Feb  6 17:24:01 2009
@@ -70,8 +70,6 @@
 
     private long written;
     
-    private OutputStream out = null;
-
     /**
      * Check to make sure that this stream has not been closed
      *
@@ -90,7 +88,7 @@
      * @param format The format of the stream
      */
     public CpioArchiveOutputStream(final OutputStream out, final short format) {
-    	this.out = new FilterOutputStream(out);
+        super(out);
         setFormat(format);
     }
 

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStream.java?rev=741641&r1=741640&r2=741641&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveOutputStream.java
Fri Feb  6 17:24:01 2009
@@ -23,9 +23,9 @@
 
 import org.apache.commons.compress.archivers.ArchiveEntry;
 import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
-import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
+import org.apache.commons.compress.archivers.zip.ZipOutputStream;
 
-public class JarArchiveOutputStream extends ZipArchiveOutputStream {
+public class JarArchiveOutputStream extends ZipOutputStream {
 
 	public JarArchiveOutputStream( final OutputStream out ) {
 		super(out);

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=741641&r1=741640&r2=741641&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
Fri Feb  6 17:24:01 2009
@@ -26,10 +26,8 @@
 
 public class TarArchiveOutputStream extends ArchiveOutputStream {
 
-    private final TarOutputStream out;
-    
     public TarArchiveOutputStream(OutputStream out) {
-        this.out = new TarOutputStream(out);
+        super(new TarOutputStream(out));
     }
     
     public void close() throws IOException {
@@ -37,11 +35,11 @@
     }
 
     public void closeArchiveEntry() throws IOException {
-        this.out.closeEntry();
+        ((TarOutputStream) out).closeEntry();
     }
 
     public void putArchiveEntry(ArchiveEntry entry) throws IOException {
-        this.out.putNextEntry((TarArchiveEntry)entry);
+        ((TarOutputStream) 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/ZipOutputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipOutputStream.java?rev=741641&r1=741640&r2=741641&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipOutputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipOutputStream.java
Fri Feb  6 17:24:01 2009
@@ -34,6 +34,9 @@
 import java.util.zip.Deflater;
 import java.util.zip.ZipException;
 
+import org.apache.commons.compress.archivers.ArchiveEntry;
+import org.apache.commons.compress.archivers.ArchiveOutputStream;
+
 /**
  * Reimplementation of {@link java.util.zip.ZipOutputStream
  * java.util.zip.ZipOutputStream} that does handle the extended
@@ -54,7 +57,7 @@
  * #putNextEntry putNextEntry} can be called.</p>
  *
  */
-public class ZipOutputStream extends FilterOutputStream {
+public class ZipOutputStream extends ArchiveOutputStream {
 
     private static final int BYTE_MASK = 0xFF;
     private static final int SHORT = 2;
@@ -562,6 +565,14 @@
         }
     }
 
+    public void putArchiveEntry(ArchiveEntry entry) throws IOException {
+        putNextEntry((ZipArchiveEntry) entry);
+    }
+
+    public void closeArchiveEntry() {
+        // do nothing
+    }
+
     /*
      * Various ZIP constants
      */



Mime
View raw message