问题
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:
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.
来源:https://stackoverflow.com/questions/11048450/android-non-blocking-file-i-o