Here you can find the source of copyFile(String src, String dest)
public static void copyFile(String src, String dest)
//package com.java2s; //License from project: Apache License import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; public class Main { public static void copyFile(String src, String dest) { InputStream is = null;//from w ww .ja v a2 s . co m FileOutputStream fos = null; try { is = new FileInputStream(src); fos = new FileOutputStream(dest); int c = 0; byte[] array = new byte[1024]; while ((c = is.read(array)) >= 0) { fos.write(array, 0, c); } } catch (Exception e) { e.printStackTrace(); } finally { try { fos.close(); is.close(); } catch (Exception e) { e.printStackTrace(); } } } }