//开启通道新方式
FileChannel inChannel = FileChannel.open(Paths.get("E:/Program Files/NIO/nio.zip"), StandardOpenOption.READ);
FileChannel ouChannel = FileChannel.open(Paths.get("E:/Program Files/NIO/nio2.zip"), StandardOpenOption.READ,StandardOpenOption.WRITE,StandardOpenOption.CREATE);
//利用通道之间的传输来复制数据,实际用的是内存映射的方式
inChannel.transferTo(0, inChannel.size(), ouChannel);
inChannel.close();
ouChannel.close();
System.out.println("game over...");
FileChannel inChannel = FileChannel.open(Paths.get("E:/Program Files/NIO/nio.zip"), StandardOpenOption.READ);
FileChannel ouChannel = FileChannel.open(Paths.get("E:/Program Files/NIO/nio2.zip"), StandardOpenOption.READ,StandardOpenOption.WRITE,StandardOpenOption.CREATE);
//利用通道之间的传输来复制数据,实际用的是内存映射的方式
inChannel.transferTo(0, inChannel.size(), ouChannel);
inChannel.close();
ouChannel.close();
System.out.println("game over...");