开发者

Fastest method to read/write to SD card in Android?

开发者 https://www.devze.com 2023-01-07 23:29 出处:网络
There are a lot of different classes th开发者_开发知识库at can be used in various ways to read/write to files in Android. For example, you can make use of java.nio.ByteBuffer, FileOutputStream and Buf

There are a lot of different classes th开发者_开发知识库at can be used in various ways to read/write to files in Android. For example, you can make use of java.nio.ByteBuffer, FileOutputStream and BufferedOutputStream. Are there any general guidelines for what to use to read/write quickly to the SD card? For example, BufferedOutputStream seems as if it should make things faster but I'm unsure the buffer size should be set for.

Specifically, I want to read/write byte arrays that are ~1Mb in size as quickly as I can.


This document benchmarks different ways to read files quickly in Java on a PC (the 'Conclusions' section is definitely worth a read). You might find it useful as guidance, but you should really just try different approaches and see what works quickest for you.

0

精彩评论

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