Here you can find the source of copyFile(File source, File destination)
public static final void copyFile(File source, File destination) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.nio.channels.FileChannel; public class Main { public static final void copyFile(File source, File destination) throws IOException { FileChannel sourceChannel = new FileInputStream(source) .getChannel();// w w w . j a va 2s.co m FileChannel targetChannel = new FileOutputStream(destination) .getChannel(); sourceChannel.transferTo(0, sourceChannel.size(), targetChannel); sourceChannel.close(); targetChannel.close(); } }