From commits-return-4949-apmail-commons-commits-archive=commons.apache.org@commons.apache.org Wed Feb 11 07:44:27 2009 Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 49946 invoked from network); 11 Feb 2009 07:44:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Feb 2009 07:44:26 -0000 Received: (qmail 25647 invoked by uid 500); 11 Feb 2009 07:44:25 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 25591 invoked by uid 500); 11 Feb 2009 07:44:25 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 25582 invoked by uid 99); 11 Feb 2009 07:44:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Feb 2009 23:44:25 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Feb 2009 07:44:23 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 1EFC523888F4; Wed, 11 Feb 2009 07:44:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@commons.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090211074402.1EFC523888F4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 = "!\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 {