Here you can find the source of copyFile(String in, String out)
public static boolean copyFile(String in, String out)
//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 boolean copyFile(String in, String out) { File inFile = new File(in); File outFile = new File(out); FileChannel inChannel = null; FileChannel outChannel = null; try {/*from www. j a v a 2 s . c o m*/ inChannel = new FileInputStream(inFile).getChannel(); outChannel = new FileOutputStream(outFile).getChannel(); // hack for files larger than 64Mb int maxCount = (64 * 1024 * 1024) - (32 * 1024); long size = inChannel.size(); long position = 0; while (position < size) { position += inChannel.transferTo(position, maxCount, outChannel); } } catch (IOException e) { return false; } finally { if (inChannel != null) { try { inChannel.close(); } catch (Exception e) { } } if (outChannel != null) { try { outChannel.close(); } catch (Exception e) { } } } return true; } }