Search code examples
androidniobytebufferandroid-contentresolvermappedbytebuffer

How to wrap Uri content with a nio.ByteBuffer on Android?


I'm trying to read content from a Uri on Android, and I need the final Object type passed to the underlying SDK to by a nio.ByteBuffer.

I can get my hands on an InputStream, via ContentResolver but didn't find a way to wrap it with an nio.ByteBuffer.

Is there a way to convert a Uri content to a nio.ByteBuffer on Android?


Solution

  • I've ended up downloading the content of the Uri locally and open it via other method to get the ByteBuffer