Here you can find the source of fileCopy(String sFrom, String sTo)
public static synchronized void fileCopy(String sFrom, String sTo) throws IOException
//package com.java2s; import java.io.*; public class Main { public static synchronized void fileCopy(String sFrom, String sTo) throws IOException { File f1 = new File(sFrom); File f2 = new File(sTo); InputStream in = new FileInputStream(f1); OutputStream out = new FileOutputStream(f2); byte[] buf = new byte[1024]; int len;/*from w w w . j a v a2s . c om*/ while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } in.close(); out.close(); System.out.println("File copied."); } }