import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; public class JavaStreamReader2 { public static void main(String[] args) throws IOException { /* ファイルの文字コードを指定して読み込む */ File file = new File("C:\\temp\\test1.txt"); try { BufferedReader b_reader = new BufferedReader(new InputStreamReader(new FileInputStream(file))); String data; while ((data =b_reader.readLine()) != null) { System.out.println(data); } // 最後にファイルを閉じてリソースを開放する b_reader.close(); } catch (UnsupportedEncodingException | FileNotFoundException e) { e.printStackTrace(); } } }