Here you can find the source of copy(File from, File to)
public static void copy(File from, File to)
//package com.java2s; //License from project: Open Source License import java.io.*; import java.nio.channels.*; public class Main { public static void copy(File from, File to) { try (FileInputStream fin = new FileInputStream(from); FileChannel in = fin.getChannel(); FileOutputStream fout = new FileOutputStream(to); FileChannel out = fout.getChannel()) { in.transferTo(0, from.length(), out); } catch (IOException e) { throw new RuntimeException(e); }// ww w .j a va2 s .c o m } }