List of utility methods to do Path File Content
void | writeToFile(Path absolutePath, byte[] content) write To File try (FileOutputStream fos = new FileOutputStream(absolutePath.toString())) { fos.write(content); |
void | writeToFile(Path file, String content) Writes given string to a file. Files.write(file, content.getBytes(CHARSET)); |
void | writeToFile(Path path, String content) write To File Writer writer = null; try { BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(path.toString())); writer = new OutputStreamWriter(outputStream); writer.write(content); } finally { if (writer != null) writer.close(); ... |
void | writeToFile(String content, String filePath) write To File Path path = Paths.get(filePath); try { Files.write(path, content.getBytes("utf-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); |
void | writeToFile(String filePath, String content) write To File try { Files.write(Paths.get(filePath), content.getBytes()); } catch (IOException e) { e.printStackTrace(); |