Ask about AAssetManager_open AASSET_MODE_RANDOM

153 views
Skip to first unread message

Giang Đỗ

unread,
Sep 17, 2015, 4:24:02 PM9/17/15
to android-ndk
AFAIK, random access a file in a zip archive is pain, but there is AAssetManager_open with AASSET_MODE_RANDOM. I think if I want to use AAsset_seek I have to open with AASSET_MODE_RANDOM. Is it right?
Is the file in apk indexed to support random access by chunk?

Alex Cohn

unread,
Oct 7, 2015, 4:10:50 PM10/7/15
to android-ndk
The compressed assets are unzipped for you almost transparently. But based on the MIME type, other assets are not compressed. The list includes JPEG, PNG, MP3, and MP4. For these assets, the Asset Manager gives you a handle to the whole Assets file, with offset to the beginning of the requested asset. You can efficiently seek around this asset, but in my experience it is also very easy to miss the bounds and reach data that belongs to other assets. So, please be careful with this API.

Cheers,
Alex
Reply all
Reply to author
Forward
0 new messages