store a Byte[] in an sqlite db in small chunks?
I wou开发者_如何学Gold like to store a large Byte[]
in my SQLite database.
Android has a limit to how much RAM each app can use, so I figured the best way to skirt around this limitation is to write the file in smaller chunks.
Is it possible to use a stream to access my file, and append to my database Byte[]
in small pieces? (without loading the Byte[]
into memory to append)
Store the data in files in your app/sdcard and keep a reference in SQLite - you cannot append to BLOBs in SQLite (at least without pre-allocating the size with zeroblob() and using the NDK) - besides - how would you read it back? The only API made available in the SDK will attempt to read the entire BLOB back as a byte[]
.
Typically you want to implement ContentProvider#openFile(..)
properly.
精彩评论