Custom ContentProvider - openInputStream(), openOutputStream()
android, android-contentprovider, file-io
Solution
MemoryFile supports this, but the public API hasn't been finalized.
Problem
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. Returning a memory mapped InputStream from a content provider? 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?