Here you can find the source of copyFileUsingChannel(File source, File dest)
public static void copyFileUsingChannel(File source, File dest) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; import java.nio.channels.FileChannel; public class Main { public static void copyFileUsingChannel(File source, File dest) throws IOException { FileChannel sourceChannel = null; FileChannel destChannel = null; try {/*from w w w . j av a2 s . c om*/ sourceChannel = new FileInputStream(source).getChannel(); destChannel = new FileInputStream(dest).getChannel(); sourceChannel.transferTo(0, sourceChannel.size(), destChannel); } finally { sourceChannel.close(); destChannel.close(); } } }