AsynchronousFileChannel异步文件通道
AsynchronousFileChannel异步文件通道
创建AsynchronousFileChannel(Creating an AsynchronousFileChannel)
Path path = Paths.get("data/test.xml");
AsynchronousFileChannel fileChannel =
AsynchronousFileChannel.open(path, StandardOpenOption.READ);读取数据(Reading Data)
通过Future读取数据(Reading Data Via a Future)
Future<Integer> operation = fileChannel.read(buffer, 0);通过CompletionHandler读取数据(Reading Data Via a CompletionHandler)
写数据(Writing Data)
通过Future写数据(Writing Data Via a Future)
通过CompletionHandler写数据(Writing Data Via a CompletionHandler)
Last updated