Fastest method to read/write to SD card in Android?
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.
精彩评论