You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2003/08/04 14:11:38 UTC
cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs UnzipTest.java
bodewig 2003/08/04 05:11:37
Modified: . WHATSNEW
docs external.html
src/etc/testcases/taskdefs unzip.xml zip.xml
src/main/org/apache/tools/ant/taskdefs Zip.java
src/main/org/apache/tools/zip ZipOutputStream.java
src/testcases/org/apache/tools/ant/taskdefs UnzipTest.java
Log:
Only calculate the CRC of STORED entries in <zip> if absolutely necessary.
PR: 21899
Revision Changes Path
1.477 +3 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.476
retrieving revision 1.477
diff -u -r1.476 -r1.477
--- WHATSNEW 1 Aug 2003 06:45:01 -0000 1.476
+++ WHATSNEW 4 Aug 2003 12:11:37 -0000 1.477
@@ -548,6 +548,9 @@
<parallel> to throw an exception if any thread fails without
waiting for all other threads to complete.
+* <zip> and friends will consume far less memory than they used to
+ when run with compress="false". Bugzilla Report 21899.
+
Changes from Ant 1.5.2 to Ant 1.5.3
===================================
1.126 +37 -0 ant/docs/external.html
Index: external.html
===================================================================
RCS file: /home/cvs/ant/docs/external.html,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -r1.125 -r1.126
--- external.html 1 Aug 2003 12:28:22 -0000 1.125
+++ external.html 4 Aug 2003 12:11:37 -0000 1.126
@@ -3893,6 +3893,43 @@
</td>
</tr>
</table>
+ <h4 class="subsection">
+ <a name="Zelix KlassMaster Java Obfuscator"></a>
+ Zelix KlassMaster Java Obfuscator
+ </h4>
+ <p>The task ZKMTask allows the Zelix KlassMaster Java obfuscator to be integrated into an Ant build.</p>
+ <table class="externals" cellspacing="1" cellpadding="4">
+ <tr>
+ <th colspan="1" rowspan="1"
+ valign="top" align="left">
+ Compatibility:
+ </th>
+ <td colspan="1" rowspan="1"
+ valign="top" align="left">
+ Ant 1.4.1
+ </td>
+ </tr>
+ <tr>
+ <th colspan="1" rowspan="1"
+ valign="top" align="left">
+ URL:
+ </th>
+ <td colspan="1" rowspan="1"
+ valign="top" align="left">
+ <a href="http://www.zelix.com/klassmaster/docs/buildToolApi.html">Zelix KlassMaster Ant Task</a>
+ </td>
+ </tr>
+ <tr>
+ <th colspan="1" rowspan="1"
+ valign="top" align="left">
+ License:
+ </th>
+ <td colspan="1" rowspan="1"
+ valign="top" align="left">
+ Commercial
+ </td>
+ </tr>
+ </table>
</div>
</div>
1.8 +6 -0 ant/src/etc/testcases/taskdefs/unzip.xml
Index: unzip.xml
===================================================================
RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/unzip.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- unzip.xml 3 Jul 2003 13:02:01 -0000 1.7
+++ unzip.xml 4 Aug 2003 12:11:37 -0000 1.8
@@ -27,6 +27,12 @@
<ant antfile="zip.xml" target="cleanup" />
</target>
+ <target name="testUncompressedZipTask">
+ <ant antfile="zip.xml" target="uncompressed-feather" />
+ <unzip src="asf-logo.gif.zip" dest="." />
+ <ant antfile="zip.xml" target="cleanup" />
+ </target>
+
<target name="realTest">
<unzip src="expected/asf-logo.gif.zip" dest="." />
</target>
1.13 +6 -0 ant/src/etc/testcases/taskdefs/zip.xml
Index: zip.xml
===================================================================
RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/zip.xml,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- zip.xml 2 May 2003 14:24:57 -0000 1.12
+++ zip.xml 4 Aug 2003 12:11:37 -0000 1.13
@@ -55,6 +55,12 @@
includes="asf-logo.gif" />
</target>
+ <target name="uncompressed-feather">
+ <zip destFile="asf-logo.gif.zip"
+ basedir=".."
+ includes="asf-logo.gif" compress="false"/>
+ </target>
+
<!-- legacy attribute support -->
<target name="test8">
<zip zipfile="test8.zip" basedir="." >
1.113 +2 -6 ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
Index: Zip.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -r1.112 -r1.113
--- Zip.java 30 Jul 2003 12:23:10 -0000 1.112
+++ Zip.java 4 Aug 2003 12:11:37 -0000 1.113
@@ -977,15 +977,11 @@
/*
* ZipOutputStream.putNextEntry expects the ZipEntry to
* know its size and the CRC sum before you start writing
- * the data when using STORED mode.
+ * the data when using STORED mode - unless it is seekable.
*
* This forces us to process the data twice.
- *
- * In DEFLATED mode, it will take advantage of a Zip
- * Version 2 feature where size can be stored after the
- * data (as the data itself signals end of data).
*/
- if (!doCompress) {
+ if (!zOut.isSeekable() && !doCompress) {
long size = 0;
CRC32 cal = new CRC32();
if (!in.markSupported()) {
1.17 +20 -6 ant/src/main/org/apache/tools/zip/ZipOutputStream.java
Index: ZipOutputStream.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/zip/ZipOutputStream.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- ZipOutputStream.java 22 Jul 2003 12:13:10 -0000 1.16
+++ ZipOutputStream.java 4 Aug 2003 12:11:37 -0000 1.17
@@ -80,12 +80,12 @@
* file.</p>
*
* <p>If RandomAccessFile cannot be used, this implementation will use
- * a Data Descriptor to store size and
- * CRC information for DEFLATED entries, this means, you don't need to
+ * a Data Descriptor to store size and CRC information for {@link
+ * #DEFLATED DEFLATED} entries, this means, you don't need to
* calculate them yourself. Unfortunately this is not possible for
- * the STORED method, here setting the CRC and uncompressed size
- * information is required before {@link #putNextEntry putNextEntry}
- * will be called.</p>
+ * the {@link #STORED STORED} method, here setting the CRC and
+ * uncompressed size information is required before {@link
+ * #putNextEntry putNextEntry} can be called.</p>
*
* @author Stefan Bodewig
* @author Richard Evans
@@ -288,6 +288,20 @@
}
out = new FileOutputStream(file);
}
+ }
+
+ /**
+ * Is this archive writing to a seekable stream (i.e. a random
+ * access file)?
+ *
+ * <p>For seekable streams, you don't need to calculate the CRC or
+ * uncompressed size for {@link #STORED STORED} entries before
+ * invoking {@link #putEntry putEntry}.
+ *
+ * @since 1.17
+ */
+ public boolean isSeekable() {
+ return raf != null;
}
/**
1.13 +7 -0 ant/src/testcases/org/apache/tools/ant/taskdefs/UnzipTest.java
Index: UnzipTest.java
===================================================================
RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/UnzipTest.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- UnzipTest.java 3 Jul 2003 13:02:01 -0000 1.12
+++ UnzipTest.java 4 Aug 2003 12:11:37 -0000 1.13
@@ -101,6 +101,13 @@
project.resolveFile("asf-logo.gif")));
}
+ public void testTestUncompressedZipTask() throws java.io.IOException {
+ FileUtils fileUtils = FileUtils.newFileUtils();
+ executeTarget("testUncompressedZipTask");
+ assertTrue(fileUtils.contentEquals(project.resolveFile("../asf-logo.gif"),
+ project.resolveFile("asf-logo.gif")));
+ }
+
/*
* PR 11100
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org