BitShifter
BitShifter

Reputation: 23

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

There are a lot of different classes that 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.

Upvotes: 2

Views: 1588

Answers (1)

Dave
Dave

Reputation: 6104

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.

Upvotes: 1

Related Questions