Here you can find the source of copyFile(String inputFile, String outputFile)
public static void copyFile(String inputFile, String outputFile) throws FileNotFoundException
//package com.java2s; 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 void copyFile(String inputFile, String outputFile) throws FileNotFoundException { File sFile = new File(inputFile); File tFile = new File(outputFile); FileInputStream fis = new FileInputStream(sFile); FileOutputStream fos = new FileOutputStream(tFile); int temp = 0; try {//from ww w. j a va 2 s .c om while ((temp = fis.read()) != -1) { fos.write(temp); } } catch (IOException e) { e.printStackTrace(); } finally { try { fis.close(); fos.close(); } catch (IOException e) { e.printStackTrace(); } } } }