NIO_通道之间传输数据

通道之间传输数据

  transferFrom()

  transferTo()

@Test
public void test3() throws IOException {
FileChannel inChannel = FileChannel.open(Paths.get("1.png"), StandardOpenOption.READ);
FileChannel outChannel = FileChannel.open(Paths.get("4.png"),StandardOpenOption.READ,StandardOpenOption.WRITE,StandardOpenOption.CREATE); inChannel.transferTo(0, inChannel.size(), outChannel); outChannel.close();
inChannel.close();
}
上一篇:android studio 问题1


下一篇:【开源】C#信息抽取系统【招募C#队友】