Return-Path: Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: (qmail 46389 invoked from network); 27 Aug 2009 04:18:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 27 Aug 2009 04:18:40 -0000 Received: (qmail 44254 invoked by uid 500); 27 Aug 2009 04:18:40 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 44176 invoked by uid 500); 27 Aug 2009 04:18:39 -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 44167 invoked by uid 99); 27 Aug 2009 04:18:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Aug 2009 04:18:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Thu, 27 Aug 2009 04:18:34 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D3D5F23888D2; Thu, 27 Aug 2009 04:18:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r808278 - in /ant/sandbox/antlibs/compress/trunk/src: main/org/apache/ant/compress/ main/org/apache/ant/compress/taskdefs/ main/org/apache/ant/compress/util/ tests/antunit/ tests/resources/ Date: Thu, 27 Aug 2009 04:18:12 -0000 To: notifications@ant.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090827041812.D3D5F23888D2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bodewig Date: Thu Aug 27 04:18:11 2009 New Revision: 808278 URL: http://svn.apache.org/viewvc?rev=808278&view=rev Log: gunzip and bunzip2 tasks Added: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/BUnzip2.java (with props) ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/GUnzip.java (with props) ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java (contents, props changed) - copied, changed from r808260, ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/GUnzip.java ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/BZip2StreamFactory.java (with props) ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/CompressorStreamFactory.java - copied, changed from r808274, ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/ArchiveStreamFactory.java ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/GZipStreamFactory.java (with props) ant/sandbox/antlibs/compress/trunk/src/tests/antunit/bunzip2-test.xml (contents, props changed) - copied, changed from r808260, ant/core/trunk/src/etc/testcases/taskdefs/bunzip2.xml ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml (contents, props changed) - copied, changed from r808260, ant/core/trunk/src/etc/testcases/taskdefs/gunzip.xml ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo-huge.tar.bz2 (props changed) - copied unchanged from r808260, ant/core/trunk/src/etc/testcases/taskdefs/expected/asf-logo-huge.tar.bz2 ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo.gif.bz2 (props changed) - copied unchanged from r808260, ant/core/trunk/src/etc/testcases/taskdefs/expected/asf-logo.gif.bz2 ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo.gif.gz (props changed) - copied unchanged from r808260, ant/core/trunk/src/etc/testcases/taskdefs/expected/asf-logo.gif.gz Modified: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml Modified: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml?rev=808278&r1=808277&r2=808278&view=diff ============================================================================== --- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml (original) +++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/antlib.xml Thu Aug 27 04:18:11 2009 @@ -48,6 +48,14 @@ name="zip" classname="org.apache.ant.compress.taskdefs.Zip" /> + + dest.lastModified()) { log("Expanding " + source.getAbsolutePath() + " to " - + dest.getAbsolutePath()); + + dest.getAbsolutePath()); FileOutputStream out = null; - GZIPInputStream zIn = null; + CompressorInputStream zIn = null; InputStream fis = null; try { out = new FileOutputStream(dest); fis = srcResource.getInputStream(); - zIn = new GZIPInputStream(fis); + zIn = factory.getCompressorStream(new BufferedInputStream(fis)); byte[] buffer = new byte[BUFFER_SIZE]; int count = 0; do { @@ -69,7 +74,7 @@ count = zIn.read(buffer, 0, buffer.length); } while (count != -1); } catch (IOException ioe) { - String msg = "Problem expanding gzip " + ioe.getMessage(); + String msg = "Problem expanding " + ioe.getMessage(); throw new BuildException(msg, ioe, getLocation()); } finally { FileUtils.close(fis); @@ -80,17 +85,9 @@ } /** - * Whether this task can deal with non-file resources. - * - *

This implementation returns true only if this task is - * <gunzip>. Any subclass of this class that also wants to - * support non-file resources needs to override this method. We - * need to do so for backwards compatibility reasons since we - * can't expect subclasses to support resources.

- * @return true if this task supports non file resources. - * @since Ant 1.7 + * Yes, we can. */ - protected boolean supportsNonFileResources() { - return getClass().equals(GUnzip.class); + protected final boolean supportsNonFileResources() { + return true; } } Propchange: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Propchange: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java ------------------------------------------------------------------------------ svn:mergeinfo = Added: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/BZip2StreamFactory.java URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/BZip2StreamFactory.java?rev=808278&view=auto ============================================================================== --- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/BZip2StreamFactory.java (added) +++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/BZip2StreamFactory.java Thu Aug 27 04:18:11 2009 @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.ant.compress.util; + +import java.io.InputStream; +import java.io.IOException; +import java.io.OutputStream; + +import org.apache.commons.compress.compressors.CompressorInputStream; +import org.apache.commons.compress.compressors.CompressorOutputStream; +import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream; +import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream; + +/** + * Creates streams for the supported compression formats. + */ +public class BZip2StreamFactory implements CompressorStreamFactory { + + /** + * @param stream the stream to read from, should be buffered + */ + public CompressorInputStream getCompressorStream(InputStream stream) + throws IOException { + return new BZip2CompressorInputStream(stream); + } + + + /** + * @param stream the stream to write to, should be buffered + */ + public CompressorOutputStream getCompressorStream(OutputStream stream) + throws IOException { + return new BZip2CompressorOutputStream(stream); + } +} \ No newline at end of file Propchange: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/BZip2StreamFactory.java ------------------------------------------------------------------------------ svn:eol-style = native Copied: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/CompressorStreamFactory.java (from r808274, ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/ArchiveStreamFactory.java) URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/CompressorStreamFactory.java?p2=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/CompressorStreamFactory.java&p1=ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/ArchiveStreamFactory.java&r1=808274&r2=808278&rev=808278&view=diff ============================================================================== --- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/ArchiveStreamFactory.java (original) +++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/CompressorStreamFactory.java Thu Aug 27 04:18:11 2009 @@ -22,31 +22,25 @@ import java.io.IOException; import java.io.OutputStream; -import org.apache.commons.compress.archivers.ArchiveInputStream; -import org.apache.commons.compress.archivers.ArchiveOutputStream; +import org.apache.commons.compress.compressors.CompressorInputStream; +import org.apache.commons.compress.compressors.CompressorOutputStream; /** - * Creates streams for the supported archive formats. + * Creates streams for the supported compression formats. */ -public interface ArchiveStreamFactory { +public interface CompressorStreamFactory { /** * @param stream the stream to read from, should be buffered - * @param encoding the encoding of the entry names, ignored by all - * formats except zip */ - public ArchiveInputStream getArchiveStream(InputStream stream, - String encoding) + public CompressorInputStream getCompressorStream(InputStream stream) throws IOException; /** * @param stream the stream to write to, should be buffered - * @param encoding the encoding of the entry names, ignored by all - * formats except zip */ - public ArchiveOutputStream getArchiveStream(OutputStream stream, - String encoding) + public CompressorOutputStream getCompressorStream(OutputStream stream) throws IOException; } \ No newline at end of file Added: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/GZipStreamFactory.java URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/GZipStreamFactory.java?rev=808278&view=auto ============================================================================== --- ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/GZipStreamFactory.java (added) +++ ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/GZipStreamFactory.java Thu Aug 27 04:18:11 2009 @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.ant.compress.util; + +import java.io.InputStream; +import java.io.IOException; +import java.io.OutputStream; + +import org.apache.commons.compress.compressors.CompressorInputStream; +import org.apache.commons.compress.compressors.CompressorOutputStream; +import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream; +import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream; + +/** + * Creates streams for the supported compression formats. + */ +public class GZipStreamFactory implements CompressorStreamFactory { + + /** + * @param stream the stream to read from, should be buffered + */ + public CompressorInputStream getCompressorStream(InputStream stream) + throws IOException { + return new GzipCompressorInputStream(stream); + } + + + /** + * @param stream the stream to write to, should be buffered + */ + public CompressorOutputStream getCompressorStream(OutputStream stream) + throws IOException { + return new GzipCompressorOutputStream(stream); + } +} \ No newline at end of file Propchange: ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/util/GZipStreamFactory.java ------------------------------------------------------------------------------ svn:eol-style = native Copied: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/bunzip2-test.xml (from r808260, ant/core/trunk/src/etc/testcases/taskdefs/bunzip2.xml) URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/tests/antunit/bunzip2-test.xml?p2=ant/sandbox/antlibs/compress/trunk/src/tests/antunit/bunzip2-test.xml&p1=ant/core/trunk/src/etc/testcases/taskdefs/bunzip2.xml&r1=808260&r2=808278&rev=808278&view=diff ============================================================================== --- ant/core/trunk/src/etc/testcases/taskdefs/bunzip2.xml (original) +++ ant/sandbox/antlibs/compress/trunk/src/tests/antunit/bunzip2-test.xml Thu Aug 27 04:18:11 2009 @@ -16,33 +16,44 @@ limitations under the License. --> - - - - + + + + + + + + + + + + - - - - + + + - - - + + + + + - - + + - - - - - - - - - \ No newline at end of file + Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/bunzip2-test.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/bunzip2-test.xml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/bunzip2-test.xml ------------------------------------------------------------------------------ svn:mergeinfo = Copied: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml (from r808260, ant/core/trunk/src/etc/testcases/taskdefs/gunzip.xml) URL: http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml?p2=ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml&p1=ant/core/trunk/src/etc/testcases/taskdefs/gunzip.xml&r1=808260&r2=808278&rev=808278&view=diff ============================================================================== --- ant/core/trunk/src/etc/testcases/taskdefs/gunzip.xml (original) +++ ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml Thu Aug 27 04:18:11 2009 @@ -16,43 +16,49 @@ limitations under the License. --> - + + + + + + + - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/gunzip-test.xml ------------------------------------------------------------------------------ svn:mergeinfo = Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo-huge.tar.bz2 ------------------------------------------------------------------------------ svn:mergeinfo = Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo-huge.tar.bz2 ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo.gif.bz2 ------------------------------------------------------------------------------ svn:mergeinfo = Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo.gif.bz2 ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo.gif.gz ------------------------------------------------------------------------------ svn:mergeinfo = Propchange: ant/sandbox/antlibs/compress/trunk/src/tests/resources/asf-logo.gif.gz ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream