ファイルの中身をひとつの StringBuffer に入れる
import java.io.FileReader; int ch; StringBuffer strBuf = new StringBuffer(); FileReader fileRd = new FileReader("foo.txt"); while((ch = fileRd.read()) != -1){ strBuf.append((char)ch); } System.out.print(strBuf);
import java.io.FileReader; int ch; StringBuffer strBuf = new StringBuffer(); FileReader fileRd = new FileReader("foo.txt"); while((ch = fileRd.read()) != -1){ strBuf.append((char)ch); } System.out.print(strBuf);