diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index b06e78f22..09573efd7 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -123,6 +123,7 @@ Ingenonsya France
Ingmar Stein
Irene Rusman
Ivan Ivanov
+J Bleijenbergh
Jack J. Woehr
James Duncan Davidson
Jan Cumps
@@ -261,6 +262,7 @@ Robert Streich
Robert Watkins
Roberto Scaramuzzi
Robin Green
+Robin Verduijn
Rob Oxspring
Rob van Oostrum
Rodrigo Schmidt
diff --git a/WHATSNEW b/WHATSNEW
index 799a63721..535152da4 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -905,6 +905,10 @@ Other changes:
a property to the number of rows affected by a task execution.
Bugzilla Report 40923.
+ * when Ant copies files without filtering, it will now use NIO
+ channels.
+ Bugzilla Report 30094.
+
Changes from Ant 1.7.0 TO Ant 1.7.1
=============================================
diff --git a/contributors.xml b/contributors.xml
index dc8fde697..30e33ab67 100644
--- a/contributors.xml
+++ b/contributors.xml
@@ -518,6 +518,10 @@
Ivan
Ivanov
+
+ J
+ Bleijenbergh
+
Jack
J.
@@ -1066,6 +1070,10 @@
Robin
Green
+
+ Robin
+ Verduijn
+
Rob
Oxspring
diff --git a/src/main/org/apache/tools/ant/util/ResourceUtils.java b/src/main/org/apache/tools/ant/util/ResourceUtils.java
index 7f821a2f6..c2e03168e 100644
--- a/src/main/org/apache/tools/ant/util/ResourceUtils.java
+++ b/src/main/org/apache/tools/ant/util/ResourceUtils.java
@@ -17,19 +17,22 @@
*/
package org.apache.tools.ant.util;
-import java.io.File;
-import java.io.Reader;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.OutputStream;
+import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.io.OutputStreamWriter;
-import java.io.BufferedInputStream;
+import java.io.Reader;
+import java.nio.channels.FileChannel;
import java.util.Arrays;
-import java.util.Vector;
import java.util.Iterator;
+import java.util.Vector;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.ProjectComponent;
@@ -433,6 +436,45 @@ public class ResourceUtils {
FileUtils.close(out);
FileUtils.close(in);
}
+ } else if (source.as(FileProvider.class) != null
+ && dest.as(FileProvider.class) != null) {
+ File sourceFile =
+ ((FileProvider) source.as(FileProvider.class)).getFile();
+ File destFile =
+ ((FileProvider) dest.as(FileProvider.class)).getFile();
+
+ File parent = destFile.getParentFile();
+ if (parent != null && !parent.isDirectory()
+ && !destFile.getParentFile().mkdirs()) {
+ throw new IOException("failed to create the parent directory"
+ + " for " + destFile);
+ }
+
+ FileInputStream in = null;
+ FileOutputStream out = null;
+ FileChannel srcChannel = null;
+ FileChannel destChannel = null;
+
+ try {
+ in = new FileInputStream(sourceFile);
+ out = new FileOutputStream(destFile);
+
+ srcChannel = in.getChannel();
+ destChannel = out.getChannel();
+
+ long position = 0;
+ long count = srcChannel.size();
+ while (position < count) {
+ position +=
+ srcChannel.transferTo(position, FileUtils.BUF_SIZE,
+ destChannel);
+ }
+ } finally {
+ FileUtils.close(srcChannel);
+ FileUtils.close(destChannel);
+ FileUtils.close(out);
+ FileUtils.close(in);
+ }
} else {
InputStream in = null;
OutputStream out = null;