[JAVA] 讀取文字檔

  • 2603
  • 0

摘要:[Java] 讀取文字檔

StringBuilder sb = new StringBuilder();
FileReader fr = new FileReader("./test.txt");
BufferedReader br = new BufferedReader(fr);
while (br.ready()) {
	sb.append(br.readLine());
​	sb.append("\r\n");
}
fr.close();
System.out.println(sb.toString());