(File f)
| 118 | this.defaultDirectory = new File(defaultDirectory).getCanonicalPath(); |
| 119 | if (!new File(defaultDirectory).exists()) new File(defaultDirectory).mkdir(); |
| 120 | } |
| 121 | |
| 122 | |
| 123 | static public String readFromFile(File f) { |
| 124 | try { |
| 125 | return Files.readAllLines(sanitizeName(f).toPath(), StandardCharsets.ISO_8859_1) |
| 126 | .stream() |
| 127 | .reduce((a, b) -> a + "\n" + b).orElse(""); |
| 128 | } catch (IOException e) { |
| 129 | e.printStackTrace(); |
| 130 | } catch (InvalidPathException e) { |
| 131 | System.err.println(" illegal character in filename ? " + sanitizeName(f).toPath() + ", continuing on"); |
| 132 | } |
| 133 | |
| 134 | return ""; |
| 135 | } |
no test coverage detected