guava/src/com/google/common/io/Files.java
@Beta
  public static void copy(File from, File to) throws IOException {
    checkArgument(!from.equals(to), "Source %s and destination %s must be different", from, to);
    asByteSource(from).copyTo(asByteSink(to));
  }
@Beta
  public static void copy(File from, File to) throws IOException {
    checkArgument(!from.equals(to), "Source %s and destination %s must be different", from, to);
    asByteSource(from).copyTo(asByteSink(to));
  }
Copies all the bytes from one file to another.

<p>Copying is not an atomic operation - in the case of an I/O error, power loss, process
termination, or other problems, {@code to} may not be a complete copy of {@code from}. If you
need to guard against those conditions, you should employ other file-level synchronization.

<p><b>Warning:</b> If {@code to} represents an existing file, that file will be overwritten
with the contents of {@code from}. If {@code to} and {@code from} refer to the <i>same</i>
file, the contents of that file will be deleted.

<p><b>{@link java.nio.file.Path} equivalent:</b> {@link
java.nio.file.Files#copy(java.nio.file.Path, java.nio.file.Path, java.nio.file.CopyOption...)}.

@param from the source file
@param to the destination file
@throws IOException if an I/O error occurs
@throws IllegalArgumentException if {@code from.equals(to)}