Here you can find the source of copyFile(String src, String dest)
public static void copyFile(String src, String dest) throws FileNotFoundException, IOException
//package com.java2s; //License from project: Creative Commons License import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void copyFile(String src, String dest) throws FileNotFoundException, IOException { int len;// ww w . j a va2 s . co m FileInputStream in = new FileInputStream(new File(src)); FileOutputStream out = new FileOutputStream(new File(dest)); byte[] buf = new byte[1024]; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } in.close(); out.close(); } }