|
@@ -155,15 +155,16 @@ public class TextFile {
|
155
|
155
|
* @throws IOException If an I/O exception occurs
|
156
|
156
|
*/
|
157
|
157
|
public void readLines() throws IOException {
|
158
|
|
- try (BufferedReader reader = path == null
|
159
|
|
- ? new BufferedReader(new InputStreamReader(is, charset))
|
160
|
|
- : Files.newBufferedReader(path, charset)) {
|
161
|
|
- lines = new ArrayList<>();
|
162
|
|
- String line;
|
163
|
|
-
|
164
|
|
- while ((line = reader.readLine()) != null) {
|
165
|
|
- lines.add(line);
|
|
158
|
+ if (path == null) {
|
|
159
|
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, charset))) {
|
|
160
|
+ lines = new ArrayList<>();
|
|
161
|
+ String line;
|
|
162
|
+ while ((line = reader.readLine()) != null) {
|
|
163
|
+ lines.add(line);
|
|
164
|
+ }
|
166
|
165
|
}
|
|
166
|
+ } else {
|
|
167
|
+ lines = Files.readAllLines(path, charset);
|
167
|
168
|
}
|
168
|
169
|
}
|
169
|
170
|
|