Here you can find the source of copyFile(String input, String output)
public static boolean copyFile(String input, String output)
//package com.java2s; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; public class Main { public static boolean copyFile(String input, String output) { File inputFile = new File(input); File outputFile = new File(output); try {/*w w w . j av a2 s . c o m*/ FileReader in = new FileReader(inputFile); FileWriter out = new FileWriter(outputFile); int c; while ((c = in.read()) != -1) out.write(c); in.close(); out.close(); } catch (IOException e) { e.printStackTrace(); return false; } return true; } public static boolean copyFile(File input, File output) { try { FileReader in = new FileReader(input); FileWriter out = new FileWriter(output); int c; while ((c = in.read()) != -1) out.write(c); in.close(); out.close(); } catch (IOException e) { e.printStackTrace(); return false; } return true; } }