Here you can find the source of copyFile(File src, File dst)
public final static void copyFile(File src, File dst) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; import java.nio.channels.FileChannel; public class Main { public final static void copyFile(File src, File dst) throws IOException { FileChannel src_channel = new FileInputStream(src).getChannel(); FileChannel dst_channel = new FileOutputStream(dst).getChannel(); src_channel.transferTo(0, Long.MAX_VALUE, dst_channel); src_channel.close();//from w w w . j av a2 s. co m dst_channel.close(); } }