以下のこのリンクによると:
http://java.sun.com/developer/technicalArticles/Programming/PerfTuning/
自分でバッファリングを行う場合(つまり、BufferedInputStreamを使用する代わりに、自分でバッファリングを処理する場合)、ビットマップ(または任意のファイル)のロードを高速化できます。
特に、アプローチ4は有望に見えます(一度にファイル全体を丸呑みにします)。しかし、Androidでそれを実装する方法がわかりません。Javaコードは次のとおりです。
import java.io.*;
public class readfile {
public static void main(String args[]) {
if (args.length != 1) {
System.err.println("missing filename");
System.exit(1);
}
try {
int len = (int)(new File(args[0]).length());
FileInputStream fis =
new FileInputStream(args[0]);
byte buf[] = new byte[len];
fis.read(buf);
fis.close();
int cnt = 0;
for (int i = 0; i < len; i++) {
if (buf[i] == '\n')
cnt++;
}
System.out.println(cnt);
}
catch (IOException e) {
System.err.println(e);
}
}
}