Here you can find the source of fileCopy(File dbFile, File backup)
private static void fileCopy(File dbFile, File backup) throws IOException
//package com.java2s; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.nio.channels.FileChannel; public class Main { private static void fileCopy(File dbFile, File backup) throws IOException { FileChannel inChannel = new FileInputStream(dbFile).getChannel(); FileChannel outChannel = new FileOutputStream(backup).getChannel(); try {/*www .j a va 2 s . c om*/ inChannel.transferTo(0, inChannel.size(), outChannel); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { if (inChannel != null) { inChannel.close(); } if (outChannel != null) { outChannel.close(); } } } }