Android non-blocking file i/o?

自古美人都是妖i 提交于 2020-02-04 08:38:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!