Android non-blocking file i/o?

2019-07-20 06:35发布

I'm currently writing an async i/o library for Java that has a very similar API to Node.js. I could do the socket part with nio, but there seems to be no FileChannel that extends SelectableChannel so I can't do the file i/o with nio, too.

In Java 7 they added AnsynchronousFileChannel, which allows non-blocking file i/o. Unfortunately, Android does not support it. Is there an equivalent class on Android to do non-blocking file io?

You can find the library here: https://github.com/VanCoding/Node.java

A sample App is located here: https://github.com/VanCoding/Node.java/blob/master/src/node/examples/App.java

1条回答
够拽才男人
2楼-- · 2019-07-20 06:58

Is there an equivalent class on Android to do non-blocking file io?

Other than your wrapping traditional I/O in a background thread, no, sorry.

查看更多
登录 后发表回答