自定义的ContentProvider - openInputStream(),openOutputStream() [英] Custom ContentProvider - openInputStream(), openOutputStream()

查看:674
本文介绍了自定义的ContentProvider - openInputStream(),openOutputStream()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在内容提供商/解析器API提供使用URI和进程间传输数据的复杂,但强大的方式 openInputStream() openOutputStream ()的方法。自定义内容供应商必须使用自定义code重写中openFile()的方法,有效地解决URI成流的能力;然而,该方法签名中openFile()有一个 ParcelFileDescriptor 返回类型,它目前还不清楚人们可能产生对于动态生成的内容,从这个方法返回正确的重新presentation。

The content provider/ resolver APIs provide a complicated, but robust way of transferring data between processes using a URI and the openInputStream() and openOutputStream() methods. Custom content providers have the ability to override the openFile() method with custom code to effectively resolve a URI into a Stream; however, the method signature of openFile() has a ParcelFileDescriptor return type and it is not clear how one might generate a proper representation for dynamically generated content to return from this method.

<一个href="http://stackoverflow.com/questions/1542008/returning-a-memory-mapped-inputstream-from-a-content-provider">Returning内存映射的InputStream从内容提供商?

是否有实施 ContentProvider.openFile()方法,在现有的code碱基动态内容的例子吗?如果没有,你可以提示源$ C ​​$ C或处理这样做?

Are there examples of implementing ContentProvider.openFile() method for dynamic content in the existing code base? If not can you suggest source code or process for doing so?

推荐答案

MemoryFile支持这一点,但公共API还没有最后确定。

MemoryFile supports this, but the public API hasn't been finalized.

这篇关于自定义的ContentProvider - openInputStream(),openOutputStream()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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