Last active
June 2, 2020 05:32
-
-
Save no1fushi/881f9b5578d7750698ae5668d964295d to your computer and use it in GitHub Desktop.
For the blog ( https://no1fushi.hateblo.jp/entry/2019/12/21/130328 )
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
public String openFile() { | |
String fn = ""; | |
String all = ""; | |
try { | |
FileReader fr = new FileReader(fn); | |
BufferedReader br = new BufferedReader(fr); | |
String buf; | |
while ((buf = br.readLine()) != null) { | |
all += buf; | |
all += System.getProperty("line.separator"); | |
} | |
br.close(); | |
fr.close(); | |
} catch (Exception e) { | |
System.out.println("Error reading file"); | |
System.exit(1); | |
} | |
return all; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment