You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2011/08/05 16:22:01 UTC

svn commit: r1154235 - /ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java

Author: bodewig
Date: Fri Aug  5 14:22:00 2011
New Revision: 1154235

URL: http://svn.apache.org/viewvc?rev=1154235&view=rev
Log:
no need to write a copy method if CC contains one

Modified:
    ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java

Modified: ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java
URL: http://svn.apache.org/viewvc/ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java?rev=1154235&r1=1154234&r2=1154235&view=diff
==============================================================================
--- ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java (original)
+++ ant/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java Fri Aug  5 14:22:00 2011
@@ -26,6 +26,7 @@ import java.io.InputStream;
 import org.apache.ant.compress.util.CompressorStreamFactory;
 import org.apache.ant.compress.util.StreamHelper;
 import org.apache.commons.compress.compressors.CompressorInputStream;
+import org.apache.commons.compress.utils.IOUtils;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.taskdefs.Unpack;
@@ -71,12 +72,7 @@ public abstract class UnpackBase extends
                     fis = srcResource.getInputStream();
                     zIn = factory.getCompressorStream(new BufferedInputStream(fis));
                 }
-                byte[] buffer = new byte[BUFFER_SIZE];
-                int count = 0;
-                do {
-                    out.write(buffer, 0, count);
-                    count = zIn.read(buffer, 0, buffer.length);
-                } while (count != -1);
+                IOUtils.copy(zIn, out, BUFFER_SIZE);
             } catch (IOException ioe) {
                 String msg = "Problem expanding " + ioe.getMessage();
                 throw new BuildException(msg, ioe, getLocation());