Skip to content Skip to sidebar Skip to footer

Returning A Memory Mapped Inputstream From A Content Provider?

The the client side of a content provider consumer I can do something like this, to get a proper InputStream for reading the picture: InputStream is = getContentResolver().openInpu

Solution 1:

This is tough. You might be able to get away with using anything that can use a Socket interface. I haven't done it, but this is what makes me think so:

http://developer.android.com/reference/android/os/ParcelFileDescriptor.html#fromSocket(java.net.Socket)

And a Socket could, in theory, be an Internet resource, or most anything...if you're willing to work at the Socket level. I would probably just give up and create the temporary file. Perhaps that makes me a coward.

Solution 2:

As of android-9, you can make a pipe using ParcelFileDescriptor. You can stuff up to 64k in it and be done with it, or you can set up another thread to fill it after its been read. See the answer here for more detail:

Custom ContentProvider - openInputStream(), openOutputStream()

Post a Comment for "Returning A Memory Mapped Inputstream From A Content Provider?"