Here you can find the source of fileCopy(String sourceFile, String destinationFile)
public static boolean fileCopy(String sourceFile, String destinationFile)
//package com.java2s; //License from project: Open Source License import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static boolean fileCopy(String sourceFile, String destinationFile) { boolean resultado = true; try {//from w w w.ja v a 2 s. co m File inFile = new File(sourceFile); File outFile = new File(destinationFile); FileInputStream in = new FileInputStream(inFile); FileOutputStream out = new FileOutputStream(outFile); BufferedInputStream bis = new BufferedInputStream(in); BufferedOutputStream bos = new BufferedOutputStream(out); byte[] buffer = new byte[32 * 1024]; int leido = 0; while ((leido = bis.read(buffer)) != -1) { bos.write(buffer, 0, leido); } bis.close(); bos.close(); in.close(); out.close(); } catch (IOException e) { System.err.println("Hubo un error de entrada/salida!!! " + e); resultado = false; } return resultado; } }