Here you can find the source of copyFile(File original, File parent)
public static boolean copyFile(File original, File parent)
//package com.java2s; //License from project: LGPL 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 boolean copyFile(File original, File parent) { try {/* w w w.j a v a 2 s. co m*/ FileInputStream input = new FileInputStream(original); File outputFile = new File(parent, original.getName()); FileOutputStream output = new FileOutputStream(outputFile); int data; while ((data = input.read()) != -1) { output.write(data); } input.close(); output.close(); return true; } catch (FileNotFoundException fnfe) { return false; } catch (IOException ioe) { return false; } } }