Here you can find the source of copyFile(File src, File dst)
public static boolean copyFile(File src, File dst)
//package com.java2s; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; public class Main { public static boolean copyFile(File src, File dst) { try {// w w w . ja v a 2 s . co m InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dst); // Transfer bytes from in to out byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } in.close(); out.close(); return true; } catch (Exception e) { //logger.error(e.getMessage()); return false; } } }