Here you can find the source of copyFile(File src, File destination)
public static void copyFile(File src, File destination)
//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 void copyFile(File src, File destination) { try {/*from www . j a v a 2s .c o m*/ if (!destination.exists()) { destination.createNewFile(); } FileChannel in = new FileInputStream(src).getChannel(); FileChannel out = new FileOutputStream(destination).getChannel(); out.transferFrom(in, 0, in.size()); } catch (IOException e) { e.printStackTrace(); } } }