Here you can find the source of copyFiles(File source, File dest)
public static void copyFiles(File source, File dest) 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 void copyFiles(File source, File dest) throws IOException { FileInputStream fis = null; FileOutputStream fos = null; try {/*www. jav a2 s . c o m*/ fis = new FileInputStream(source); fos = new FileOutputStream(dest); FileChannel fichannel = fis.getChannel(); FileChannel foChannel = fos.getChannel(); long size = fichannel.size(); fichannel.transferTo(0, size, foChannel); } finally { if (fis != null) { fis.close(); } if (fos != null) { fos.close(); } } } }