Index: /trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 7002)
+++ /trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 7003)
@@ -17,6 +17,4 @@
 import java.io.Closeable;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -29,6 +27,8 @@
 import java.net.URLConnection;
 import java.net.URLEncoder;
-import java.nio.channels.FileChannel;
 import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
@@ -323,26 +323,15 @@
     /**
      * Simple file copy function that will overwrite the target file.<br>
-     * Taken from <a href="http://www.rgagnon.com/javadetails/java-0064.html">this article</a> (CC-NC-BY-SA)
      * @param in The source file
      * @param out The destination file
+     * @return the path to the target file
      * @throws java.io.IOException If any I/O error occurs
-     */
-    public static void copyFile(File in, File out) throws IOException  {
-        // TODO: remove this function when we move to Java 7 (use Files.copy instead)
-        FileInputStream inStream = null;
-        FileOutputStream outStream = null;
-        try {
-            inStream = new FileInputStream(in);
-            outStream = new FileOutputStream(out);
-            FileChannel inChannel = inStream.getChannel();
-            inChannel.transferTo(0, inChannel.size(), outStream.getChannel());
-        }
-        catch (IOException e) {
-            throw e;
-        }
-        finally {
-            close(outStream);
-            close(inStream);
-        }
+     * @throws IllegalArgumentException If {@code in} or {@code out} is {@code null}
+     * @since 7003
+     */
+    public static Path copyFile(File in, File out) throws IOException, IllegalArgumentException  {
+        CheckParameterUtil.ensureParameterNotNull(in, "in");
+        CheckParameterUtil.ensureParameterNotNull(out, "out");
+        return Files.copy(in.toPath(), out.toPath(), StandardCopyOption.REPLACE_EXISTING);
     }
 
