Android的非阻塞文件I / O? [英] Android non-blocking file i/o?

查看:219
本文介绍了Android的非阻塞文件I / O?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在写的Java有一个非常类似的API来Node.js的异步I / O库我可以做NIO插座部分,但似乎没有FileChannel扩展的SelectableChannel,所以我不能做文件I / O与NIO了。

在Java 7中他们增加AnsynchronousFileChannel,它允许非阻塞文件I / O。不幸的是,Android不支持它。有没有在Android上的等价类做非阻塞文件IO?

您可以在这里找到库: https://github.com/VanCoding/Node.java

应用程序就设在这里的示例: HTTPS ://github.com/VanCoding/Node.java/blob/master/src/node/examples/App.java


解决方案

  

有没有在Android上的等价类做非阻塞文件IO?


除了在后台线程的包装传统I / O,没有,对不起。

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

解决方案

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.

这篇关于Android的非阻塞文件I / O?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆