Here you can find the source of fileChannelCopy(File src, File dest)
public static void fileChannelCopy(File src, File dest)
//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 fileChannelCopy(File src, File dest) { FileInputStream fi = null; FileOutputStream fo = null; FileChannel in = null, out = null; try {//www . jav a 2 s . c om fi = new FileInputStream(src); fo = new FileOutputStream(dest); in = fi.getChannel(); out = fo.getChannel(); in.transferTo(0, in.size(), out); } catch (IOException e) { e.printStackTrace(); } finally { try { fi.close(); in.close(); fo.close(); out.close(); } catch (IOException e) { e.printStackTrace(); } } } }