Here you can find the source of copyFile(String srcDir, String destDir)
public static void copyFile(String srcDir, String destDir) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void copyFile(String srcDir, String destDir) throws IOException { FileInputStream in = new FileInputStream(srcDir); FileOutputStream out = new FileOutputStream(destDir); int ch;/* www . j ava2 s . com*/ while ((ch = in.read()) != -1) { out.write((byte) ch); } in.close(); out.close(); } }