-
-
Save ksakae1216/6c842c7838e9282eaeb264932721925f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// try-with-resourcesでファイル読み込み | |
private void newFileRead(String file) { | |
try(FileInputStream fi = new FileInputStream(file); | |
InputStreamReader in = new InputStreamReader(fi); | |
BufferedReader br = new BufferedReader(in)) { | |
// ファイル読み込み | |
String line; | |
while( (line = br.readLine()) != null) { | |
System.out.println(line); | |
} | |
} catch(Exception e) { | |
} finally { | |
// クローズ処理不要 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment