Here you can find the source of copyFile(String fileOutPut, String fileIn)
public static void copyFile(String fileOutPut, String fileIn) throws Exception
//package com.java2s; import java.io.FileInputStream; import java.io.FileOutputStream; public class Main { public static void copyFile(String fileOutPut, String fileIn) throws Exception { FileInputStream fileInputStream = new FileInputStream(fileIn); FileOutputStream fileOutputStream = new FileOutputStream(fileOutPut); byte[] by = new byte[1024]; int len;//ww w . jav a 2s . c o m while ((len = fileInputStream.read(by)) != -1) { fileOutputStream.write(by, 0, len); } fileInputStream.close(); fileOutputStream.close(); } }