no need to write a copy method if CC contains one
git-svn-id: https://svn.apache.org/repos/asf/ant/antlibs/compress/trunk@1154235 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java b/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java
index 93941f7..96f2e5e 100644
--- a/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java
+++ b/src/main/org/apache/ant/compress/taskdefs/UnpackBase.java
@@ -26,6 +26,7 @@
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 @@
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());