forked from brianway/java-learning
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinfile.txt
More file actions
12 lines (12 loc) · 409 Bytes
/
infile.txt
File metadata and controls
12 lines (12 loc) · 409 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
-----------------------------------------
public static String read(String filename) throws IOException {
BufferedReader in = new BufferedReader(
new FileReader(filename));
String s;
StringBuilder sb = new StringBuilder();
while ((s = in.readLine()) != null) {
sb.append(s).append("\n");
}
in.close();
return sb.toString();
}