Here you can find the source of fileCopy(final File dest, final File src)
public static void fileCopy(final File dest, final File src) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.IOException; import java.io.FileInputStream; import java.io.FileOutputStream; import java.nio.channels.FileChannel; public class Main { public static void fileCopy(final File dest, final File src) throws IOException { FileInputStream in = null; FileOutputStream out = null; try {/*from ww w. j a va2 s. c o m*/ in = new FileInputStream(src); out = new FileOutputStream(dest); FileChannel fcin = in.getChannel(); FileChannel fcout = out.getChannel(); long bytes = fcin.size(); while (bytes > 0L) { bytes -= fcout.transferFrom(fcin, 0, bytes); } } finally { if (in != null) { in.close(); } if (out != null) { out.close(); } } } }