Return-Path: X-Original-To: apmail-ant-notifications-archive@minotaur.apache.org Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A6DB61064E for ; Sat, 15 Mar 2014 19:43:28 +0000 (UTC) Received: (qmail 24752 invoked by uid 500); 15 Mar 2014 19:43:27 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 24680 invoked by uid 500); 15 Mar 2014 19:43:27 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 24673 invoked by uid 99); 15 Mar 2014 19:43:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 Mar 2014 19:43:27 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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; Sat, 15 Mar 2014 19:43:24 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id DBB8D2388860 for ; Sat, 15 Mar 2014 19:43:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1577923 - in /ant/antlibs/compress/trunk: changes.xml docs/pack.html src/main/org/apache/ant/compress/taskdefs/GZip.java src/tests/antunit/gunzip-test.xml Date: Sat, 15 Mar 2014 19:43:02 -0000 To: notifications@ant.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140315194302.DBB8D2388860@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bodewig Date: Sat Mar 15 19:43:02 2014 New Revision: 1577923 URL: http://svn.apache.org/r1577923 Log: Add level attribute to gzip task. PR 52414 Modified: ant/antlibs/compress/trunk/changes.xml ant/antlibs/compress/trunk/docs/pack.html ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/GZip.java ant/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml Modified: ant/antlibs/compress/trunk/changes.xml URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/changes.xml?rev=1577923&r1=1577922&r2=1577923&view=diff ============================================================================== --- ant/antlibs/compress/trunk/changes.xml (original) +++ ant/antlibs/compress/trunk/changes.xml Sat Mar 15 19:43:02 2014 @@ -51,6 +51,10 @@ Multiple content compression/encryption/filter methods can now be specified via nested elements of the sevenz task. + + The gzip task has a new attribute that controls the level of + compression. + Modified: ant/antlibs/compress/trunk/docs/pack.html URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/docs/pack.html?rev=1577923&r1=1577922&r2=1577923&view=diff ============================================================================== --- ant/antlibs/compress/trunk/docs/pack.html (original) +++ ant/antlibs/compress/trunk/docs/pack.html Sat Mar 15 19:43:02 2014 @@ -103,6 +103,24 @@

Is a compressing task that uses the GZIP compression algorithm.

+

This task supports the following additional attributes:

+ + + + + + + + + + + + +
AttributeDescriptionRequired
levelNon-default level at which file compression + should be performed. Valid values range from 0 (no + compression/fastest) to 9 (maximum + compression/slowest). Since Compress Antlib 1.5No
+

Pack200

Is a compressing task that uses Modified: ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/GZip.java URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/GZip.java?rev=1577923&r1=1577922&r2=1577923&view=diff ============================================================================== --- ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/GZip.java (original) +++ ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/GZip.java Sat Mar 15 19:43:02 2014 @@ -18,23 +18,48 @@ package org.apache.ant.compress.taskdefs; +import java.io.IOException; +import java.io.OutputStream; +import java.util.zip.Deflater; + import org.apache.ant.compress.resources.CommonsCompressCompressorResource; import org.apache.ant.compress.resources.GZipResource; import org.apache.ant.compress.util.GZipStreamFactory; +import org.apache.commons.compress.compressors.CompressorOutputStream; +import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream; +import org.apache.commons.compress.compressors.gzip.GzipParameters; import org.apache.tools.ant.types.Resource; /** * Compresses using gzip. */ public final class GZip extends PackBase { + private int level = Deflater.DEFAULT_COMPRESSION; public GZip() { - super(new GZipStreamFactory(), - new PackBase.ResourceWrapper() { + super(new PackBase.ResourceWrapper() { public CommonsCompressCompressorResource wrap(Resource dest) { return new GZipResource(dest); } }); + setFactory(new GZipStreamFactory() { + public CompressorOutputStream getCompressorStream(OutputStream stream) + throws IOException { + GzipParameters params = new GzipParameters(); + params.setCompressionLevel(level); + return new GzipCompressorOutputStream(stream, params); + } + }); + } + + /** + * Set the compression level to use. Default is + * Deflater.DEFAULT_COMPRESSION. + * @param level compression level. + * @since 1.5 + */ + public void setLevel(int level) { + this.level = level; } -} \ No newline at end of file +} Modified: ant/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml?rev=1577923&r1=1577922&r2=1577923&view=diff ============================================================================== --- ant/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml (original) +++ ant/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml Sat Mar 15 19:43:02 2014 @@ -54,6 +54,14 @@ actual="${output}/asf-logo.gif"/> + + + + + +