/** * 复制文件 * @param in * @param out * @throws Exception */ private boolean copyFile(File in, File out) throws Exception{ FileChannel sourceChannel= new FileInputStream(in).getChannel(); FileChannel destinationChannel= new FileOutputStream(out).getChannel(); sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel); // or // destinationChannel.transferFrom(sourceChannel, 0, // sourceChannel.size()); sourceChannel.close(); destinationChannel.close(); sourceChannel= null; destinationChannel= null; return true; }