Explorar el Código

Switch to Java8 methods for TextFile.

pull/13/head
Greg Holmes hace 9 años
padre
commit
a9aa3e869f
Se han modificado 1 ficheros con 9 adiciones y 8 borrados
  1. 9
    8
      src/com/dmdirc/util/io/TextFile.java

+ 9
- 8
src/com/dmdirc/util/io/TextFile.java Ver fichero

@@ -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
 

Loading…
Cancelar
Guardar