BufferedReader雛形

import java.io.BufferedReader;
import java.io.FileReader;

public class BRTest1 {

	public static void main(String[] args) {
		doFileRead("Test1.txt");
	}
	
	private static void doFileRead(String filepath) {
		
		try(BufferedReader br = new BufferedReader(new FileReader(filepath))) {
			String line;
			while (null != (line = br.readLine())) {
				System.out.println(line);
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
	
}

BufferdReader
try-with-resources

投稿日: