开发者

store a Byte[] in an sqlite db in small chunks?

开发者 https://www.devze.com 2023-04-10 00:02 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号