Here you can find the source of fileCopy(String source, String target)
public static void fileCopy(String source, String target) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { public static void fileCopy(String source, String target) throws IOException { try (InputStream in = new FileInputStream(source)) { try (OutputStream out = new FileOutputStream(target)) { byte[] buffer = new byte[4096]; int bytesToRead; while ((bytesToRead = in.read(buffer)) != -1) { out.write(buffer, 0, bytesToRead); }/* w ww .j a va 2 s . c om*/ } } } }