public static void copy(File input, File output) throws IOException {
FileInputStream fis = new FileInputStream(input);
FileOutputStream fos = new FileOutputStream(output);
try {
FileChannel ic = fis.getChannel();
FileChannel oc = fos.getChannel();
try {
oc.transferFrom(ic, 0, ic.size());
}
finally {
oc.close();
ic.close();
}
}
finally {
fis.close();
fos.close();
}
}
|