Author: bodewig
Date: Mon Apr 19 15:18:05 2010
New Revision: 935614
URL: http://svn.apache.org/viewvc?rev=935614&view=rev
Log:
document relation between zip entry's name and whether it is assumed to be a
directory. COMPRESS-105
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/ZipArchiveOutputStream.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=935614&r1=935613&r2=935614&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
Mon Apr 19 15:18:05 2010
@@ -78,6 +78,10 @@ public class ZipArchiveEntry extends jav
/**
* Creates a new zip entry with the specified name.
+ *
+ * <p>Assumes the entry represents a directory if and only if the
+ * name ends with a forward slash "/".</p>
+ *
* @param name the name of the entry
*/
public ZipArchiveEntry(String name) {
@@ -87,6 +91,10 @@ public class ZipArchiveEntry extends jav
/**
* Creates a new zip entry with fields taken from the specified zip entry.
+ *
+ * <p>Assumes the entry represents a directory if and only if the
+ * name ends with a forward slash "/".</p>
+ *
* @param entry the entry to get fields from
* @throws ZipException on error
*/
@@ -107,6 +115,10 @@ public class ZipArchiveEntry extends jav
/**
* Creates a new zip entry with fields taken from the specified zip entry.
+ *
+ * <p>Assumes the entry represents a directory if and only if the
+ * name ends with a forward slash "/".</p>
+ *
* @param entry the entry to get fields from
* @throws ZipException on error
*/
@@ -123,6 +135,15 @@ public class ZipArchiveEntry extends jav
this("");
}
+ /**
+ * Creates a new zip entry taking some information from the given
+ * file and using the provided name.
+ *
+ * <p>The name will be adjusted to end with a forward slash "/" if
+ * the file is a directory. If the file is not a directory a
+ * potential trailing forward slash will be stripped from the
+ * entry name.</p>
+ */
public ZipArchiveEntry(File inputFile, String entryName) {
this(inputFile.isDirectory() && !entryName.endsWith("/") ?
entryName + "/" : entryName);
Modified:
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
URL:
http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java?rev=935614&r1=935613&r2=935614&view=diff
==============================================================================
---
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
(original)
+++
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
Mon Apr 19 15:18:05 2010
@@ -948,6 +948,17 @@ public class ZipArchiveOutputStream exte
}
}
+ /**
+ * Creates a new zip entry taking some information from the given
+ * file and using the provided name.
+ *
+ * <p>The name will be adjusted to end with a forward slash "/" if
+ * the file is a directory. If the file is not a directory a
+ * potential trailing forward slash will be stripped from the
+ * entry name.</p>
+ *
+ * <p>Must not be used if the stream has already been closed.</p>
+ */
public ArchiveEntry createArchiveEntry(File inputFile, String entryName)
throws IOException {
if(finished) {