ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r799731 - in /ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs: ExpandBase.java Unzip.java
Date Fri, 31 Jul 2009 20:06:08 GMT
Author: bodewig
Date: Fri Jul 31 20:06:07 2009
New Revision: 799731

URL: http://svn.apache.org/viewvc?rev=799731&view=rev
Log:
encoding support in unzip

Modified:
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/ExpandBase.java
    ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Unzip.java

Modified: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/ExpandBase.java
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/ExpandBase.java?rev=799731&r1=799730&r2=799731&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/ExpandBase.java
(original)
+++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/ExpandBase.java
Fri Jul 31 20:06:07 2009
@@ -40,7 +40,7 @@
  * <p>PatternSets are used to select files to extract
  * <I>from</I> the archive.  If no patternset is used, all files are extracted.
  * </p>
- * <p>FileSet's may be used to select archived files
+ * <p>FileSets may be used to select archived files
  * to perform unarchival upon.
  * </p>
  * <p>File permissions will not be restored on extracted files.</p>
@@ -56,6 +56,15 @@
                                  + " attribute", getLocation());
     }
 
+    /**
+     * No unicode extra fields in general.
+     */
+    public void setScanForUnicodeExtraFields(boolean b) {
+        throw new BuildException("The " + getTaskName()
+                                 + " task doesn't support the encoding"
+                                 + " attribute", getLocation());
+    }
+
     /** {@inheritDoc} */
     protected void expandFile(FileUtils fileUtils, File srcF, File dir) {
         if (!srcF.exists()) {

Modified: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Unzip.java
URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Unzip.java?rev=799731&r1=799730&r2=799731&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Unzip.java
(original)
+++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Unzip.java
Fri Jul 31 20:06:07 2009
@@ -40,6 +40,13 @@
  */
 public class Unzip extends ExpandBase {
 
+    public void setEncoding(String encoding) {
+        internalSetEncoding(encoding);
+    }
+    public void setScanForUnicodeExtraFields(boolean b) {
+        internalSetScanForUnicodeExtraFields(b);
+    }
+
     // overridden in order to tale advantage of ZipFile
     protected void expandFile(FileUtils fileUtils, File srcF, File dir) {
         log("Expanding: " + srcF + " into " + dir, Project.MSG_INFO);
@@ -51,7 +58,8 @@
                                      getLocation());
         }
         try {
-            zf = new ZipFile(srcF);
+            zf = new ZipFile(srcF, getEncoding(),
+                             getScanForUnicodeExtraFields());
             boolean empty = true;
             Enumeration e = zf.getEntries();
             while (e.hasMoreElements()) {
@@ -77,7 +85,8 @@
 
     protected ArchiveInputStream getArchiveStream(InputStream is)
         throws IOException {
-        return new ZipArchiveInputStream(is);
+        return new ZipArchiveInputStream(is, getEncoding(),
+                                         getScanForUnicodeExtraFields());
     }
 
     protected Date getLastModified(ArchiveEntry entry) {



Mime
View raw message