Here you can find the source of copyFile(File original, File copy)
public static boolean copyFile(File original, File copy)
//package com.java2s; /*//from w w w .ja va 2 s.c o m * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. */ import java.io.*; public class Main { /** * Copies a file. Returns <code>true</code> on success. */ public static boolean copyFile(File original, File copy) { try { FileInputStream fis = new FileInputStream(original); FileOutputStream fos = new FileOutputStream(copy); int len = fis.available(); byte[] data = new byte[len]; fis.read(data); fos.write(data); fis.close(); fos.flush(); fos.close(); } catch (IOException ioe) { return false; } return true; } }