import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
public class FileCopy {
private static void copyFileUsingChannel(File source, File target) throws IOException {
FileChannel sourceChannel = null;
FileChannel destChannel = null;
try {
sourceChannel = new FileInputStream(source).getChannel();
destChannel = new FileOutputStream(target).getChannel();
destChannel.transferFrom(sourceChannel, 0, sourceChannel.size());
}finally{
sourceChannel.close();
destChannel.close();
}
}
public static void main(String[] args) throws IOException {
copyFileUsingChannel(new File(\"E:\\\\资料\\\\项目.txt\"),new File(\"E:\\\\资料\\\\项目1.txt\"));
}
}