List of utility methods to do Path File Write nio
void | writeStringAndNewLineToBufferedWriter(String line, BufferedWriter writer, Path path) write String And New Line To Buffered Writer try { writer.write(line); writer.newLine(); } catch (IOException ex) { throw new IOException("Can't write to " + path, ex); |
void | writeStringToFile(Path path, String data) write String To File try (BufferedWriter writer = Files.newBufferedWriter(path, UTF8_CHARSET, StandardOpenOption.WRITE, StandardOpenOption.CREATE)) { writer.write(data); } catch (IOException ex) { throw new RuntimeException("Failed to write to file " + path.toAbsolutePath().toString(), ex); |
void | writeTagset(Path outPath, Set write Tagset try { Files.write(outPath, tagset); } catch (IOException e) { throw new UncheckedIOException(e); |
void | writeTestData(final String testdata, final Path tempfile) write Test Data try (final Writer os = Files.newBufferedWriter(tempfile)) { os.write(testdata); |
void | writeToFile(double[] testSample, Path classificationTestFile) write To File try (BufferedWriter bw = Files.newBufferedWriter(classificationTestFile, StandardCharsets.UTF_8, StandardOpenOption.APPEND)) { bw.append(Arrays.toString(testSample).replace('[', ' ').replace(']', ' ')); bw.append('\n'); |
void | writeToFile(final Path file, final String text) write To File Files.write(file, asList(text), Charset.forName("UTF-8"));
|
void | writeToFile(Path file, boolean isAppendingToFile, List write To File try { if (isAppendingToFile) { Files.write(file, lines, StandardCharsets.UTF_8, StandardOpenOption.APPEND); } else { Files.write(file, Arrays.asList(CSV_HEADER), StandardCharsets.UTF_8); Files.write(file, lines, StandardCharsets.UTF_8, StandardOpenOption.APPEND); } catch (Exception e) { ... |
void | writeToFile(Path path, String string) Writes the string to a file at the given path, overwriting any file present. Files.write(path, Collections.singletonList(string), UTF8); |
void | writeToFile(String log, Path path) write To File try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(path.toFile()))) { bufferedWriter.write(log); } catch (IOException e) { e.printStackTrace(); |
void | writeToFile(String s, Path file) write To File BufferedWriter writer = Files.newBufferedWriter(file, StandardCharsets.UTF_8); writer.append(s); writer.close(); |