Take the 2-minute tour ×

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.

share|improve this question
Why not write a benchmark and then share the results? –  yanchenko Jul 18 '10 at 1:35
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
Excellent, thanks. –  BitShifter Jul 18 '10 at 12:15
add comment

Your Answer


