There doesn't appear to be a way of obtaining the equivalent of
RandomAccessFile to assets (please correct me if I've missed something
obvious here). In my case I've got a simple trie implementation that
needs to seek over a binary representation which I'm bundling as an
asset in my apk. It's actually small enough to slurp into memory, but
I don't want to assume that's the case, so the way I'm doing it at
present is copying the asset into my app's data folder. But we can
guess how this extravagant use of storage space will be received by
users (see posts passim).
Scanning the harmony and framework source code, it doesn't look like
it would be too difficult to produce a class which looked something
like:
class AssetRandomAccess implements DataInput, Closeable {
...
}
which wraps a ParcelFileDescriptor obtained from
AssetManager.openAssetFd() and palms it off it to the platform's
IFileSystem implementation to do the actual shuttling of bytes. (can
code in the framework directly call the internal harmony classes?)
If I understand things correctly, the assets are stored in the apk
uncompressed, so its just a case of adjusting reads based on their
offset.
It would certainly be helpful to my application but is this something
worth adding to the framework?
Tom.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"android-framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-framework?hl=en
-~----------~----~----~----~------~----~------~--~---