commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r743259 - in /commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers: ar/ cpio/ jar/ tar/ zip/
Date Wed, 11 Feb 2009 07:44:01 GMT
Author: bodewig
Date: Wed Feb 11 07:44:00 2009
New Revision: 743259

URL: http://svn.apache.org/viewvc?rev=743259&view=rev
Log:
provide convenience getNext*Entry methods to ArchiveInputStream subclasses

Modified:
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
    commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java?rev=743259&r1=743258&r2=743259&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/ar/ArArchiveInputStream.java
Wed Feb 11 07:44:00 2009
@@ -33,7 +33,7 @@
         input = pInput;
     }
 
-    public ArchiveEntry getNextEntry() throws IOException {
+    public ArArchiveEntry getNextArEntry() throws IOException {
 
         if (offset == 0) {
             final byte[] expected = "!<arch>\n".getBytes();
@@ -90,6 +90,10 @@
     }
 
 
+    public ArchiveEntry getNextEntry() throws IOException {
+        return getNextArEntry();
+    }
+
     public int read() throws IOException {
         final int ret = input.read();
         offset++;

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java?rev=743259&r1=743258&r2=743259&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStream.java
Wed Feb 11 07:44:00 2009
@@ -435,11 +435,7 @@
     }
 
     public ArchiveEntry getNextEntry() throws IOException {
-        CpioArchiveEntry entry = this.getNextCPIOEntry();
-        if(entry == null) {
-            return null;
-        }
-        return (ArchiveEntry)entry;
+        return getNextCPIOEntry();
     }
 
     public static boolean matches(byte[] signature, int length) {

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java?rev=743259&r1=743258&r2=743259&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/jar/JarArchiveInputStream.java
Wed Feb 11 07:44:00 2009
@@ -31,13 +31,13 @@
         super(inputStream);
     }
 
+    public JarArchiveEntry getNextJarEntry() throws IOException {
+        ZipArchiveEntry entry = getNextZipEntry();
+        return entry == null ? null : new JarArchiveEntry(entry);
+    }
+
     public ArchiveEntry getNextEntry() throws IOException {
-        ZipArchiveEntry entry = (ZipArchiveEntry)super.getNextEntry();
-        if(entry == null) {
-            return null;
-        } else {
-            return (ArchiveEntry)new JarArchiveEntry(entry);
-        }
+        return getNextJarEntry();
     }
 
     public static boolean matches(byte[] signature, int length ) {

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java?rev=743259&r1=743258&r2=743259&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
Wed Feb 11 07:44:00 2009
@@ -188,7 +188,7 @@
      * @return The next TarEntry in the archive, or null.
      * @throws IOException on error
      */
-    public ArchiveEntry getNextEntry() throws IOException {
+    public TarArchiveEntry getNextTarEntry() throws IOException {
         if (hasHitEOF) {
             return null;
         }
@@ -272,6 +272,10 @@
         return currEntry;
     }
 
+    public ArchiveEntry getNextEntry() throws IOException {
+        return getNextTarEntry();
+    }
+
     /**
      * Reads a byte from the current tar archive entry.
      *

Modified: commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java?rev=743259&r1=743258&r2=743259&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
(original)
+++ commons/sandbox/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
Wed Feb 11 07:44:00 2009
@@ -33,12 +33,16 @@
         input = new ZipInputStream(inputStream);
     }
 
-    public ArchiveEntry getNextEntry() throws IOException {
+    public ZipArchiveEntry getNextZipEntry() throws IOException {
         java.util.zip.ZipEntry entry = input.getNextEntry();
         if(entry == null) {
             return null;
         }
-        return (ArchiveEntry)new ZipArchiveEntry(entry);
+        return new ZipArchiveEntry(entry);
+    }
+
+    public ArchiveEntry getNextEntry() throws IOException {
+        return getNextZipEntry();
     }
 
     public int read(byte[] b, int off, int len) throws IOException {



Mime
View raw message