如果内核不支持AIO,java AsynchronousFileChannel如何工作

时间:2015-07-08 07:33:42

标签: java linux aio

我有两个问题

  1. 如果我的操作系统不支持AIO(低于linux 2.6等),AsynchronousFileChannel将如何工作。

  2. 如何将sth追加到AsynchronousFileChannel中,据我所知,AsynchronousFileChannel只支持write(ByteBuffer,long position,A attachment,CompletionHandler handler)和write(ByteBuffer src,long position)都需要一个位置参数。我应该自己算一下这个职位吗?

1 个答案:

答案 0 :(得分:1)

问题2:来自javadoc

  

异步文件通道中没有当前位置   文件。而是为每个读取和指定文件位置   write方法,用于启动异步操作。

所以是的,你需要自己跟踪这个位置。