1try(BufferedReader br = new BufferedReader(new FileReader("file.txt"))) {
2 StringBuilder sb = new StringBuilder();
3 String line = br.readLine();
4
5 while (line != null) {
6 sb.append(line);
7 sb.append(System.lineSeparator());
8 line = br.readLine();
9 }
10 String everything = sb.toString();
11}