Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EF5BA1780F for ; Sun, 9 Aug 2015 16:06:15 +0000 (UTC) Received: (qmail 7266 invoked by uid 500); 9 Aug 2015 16:06:10 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 7196 invoked by uid 500); 9 Aug 2015 16:06:10 -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 7187 invoked by uid 99); 9 Aug 2015 16:06:10 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Aug 2015 16:06:10 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 744BCAC0095 for ; Sun, 9 Aug 2015 16:06:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1694895 - in /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip: ZipArchiveEntry.java ZipArchiveInputStream.java Date: Sun, 09 Aug 2015 16:06:10 -0000 To: commits@commons.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150809160610.744BCAC0095@hades.apache.org> Author: bodewig Date: Sun Aug 9 16:06:09 2015 New Revision: 1694895 URL: http://svn.apache.org/r1694895 Log: COMPRESS-318 document ZipArchiveInputStream's limitations in the javadocs Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java?rev=1694895&r1=1694894&r2=1694895&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java Sun Aug 9 16:06:09 2015 @@ -216,6 +216,10 @@ public class ZipArchiveEntry extends jav /** * Retrieves the internal file attributes. * + *

Note: {@link ZipArchiveInputStream} is unable to fill + * this field, you must use {@link ZipFile} if you want to read + * entries using this attribute.

+ * * @return the internal file attributes */ public int getInternalAttributes() { @@ -232,6 +236,11 @@ public class ZipArchiveEntry extends jav /** * Retrieves the external file attributes. + * + *

Note: {@link ZipArchiveInputStream} is unable to fill + * this field, you must use {@link ZipFile} if you want to read + * entries using this attribute.

+ * * @return the external file attributes */ public long getExternalAttributes() { @@ -321,6 +330,12 @@ public class ZipArchiveEntry extends jav /** * Retrieves all extra fields that have been parsed successfully. + * + *

Note: The set of extra fields may be incomplete when + * {@link ZipArchiveInputStream} has been used as some extra + * fields use the central directory to store additional + * information.

+ * * @return an array of the extra fields */ public ZipExtraField[] getExtraFields() { @@ -597,6 +612,11 @@ public class ZipArchiveEntry extends jav /** * Gets the uncompressed size of the entry data. + * + *

Note: {@link ZipArchiveInputStream} may create + * entries that return {@link #SIZE_UNKNOWN SIZE_UNKNOWN} as long + * as the entry hasn't been read completely.

+ * * @return the entry size */ @Override Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java?rev=1694895&r1=1694894&r2=1694895&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java Sun Aug 9 16:06:09 2015 @@ -43,16 +43,32 @@ import static org.apache.commons.compres /** * Implements an input stream that can read Zip archives. * - *

Note that {@link ZipArchiveEntry#getSize()} may return -1 if the - * DEFLATE algorithm is used, as the size information is not available - * from the header.

- * - *

The {@link ZipFile} class is preferred when reading from files.

- * *

As of Apache Commons Compress it transparently supports Zip64 * extensions and thus individual entries and archives larger than 4 * GB or with more than 65536 entries.

* + *

The {@link ZipFile} class is preferred when reading from files + * as {@link ZipArchiveInputStream} is limited by not being able to + * read the central directory header before returning entries. In + * particular {@link ZipArchiveInputStream}

+ * + *
    + * + *
  • may return entries that are not part of the central directory + * at all and shouldn't be considered part of the archive.
  • + * + *
  • may return several entries with the same name.
  • + * + *
  • will not return internal or external attributes.
  • + * + *
  • may return incomplete extra field data.
  • + * + *
  • may return unknown sizes and CRC values for entries until the + * next entry has been reached if the archive uses the data + * descriptor feature.
  • + * + *
+ * * @see ZipFile * @NotThreadSafe */