ファイルを読み込む

  String path = "[ファイル名]";

  BufferedReader reader =
null;
  FileInputStream fileInputStream =
null;
 
try {
   
fileInputStream = new FileInputStream(path);
    reader =
new BufferedReader(new InputStreamReader(fileInputStream, "MS932"));

    String line;
   
while ((line = reader.readLine()) != null) {
     
System.out.println(line);
   
}
  }
catch (FileNotFoundException e) {
   
e.printStackTrace();
 
} catch (IOException e) {
   
e.printStackTrace();
 
} finally {
   
try {
     
if (reader != null) {
       
reader.close();
     
}
    }
catch (Exception e) {
     
e.printStackTrace();
   
}
  }

Java TipsのTOPに戻る