List of utility methods to do Text File Write nio
void | write(File file, List write try { Files.write(file.toPath(), lines, CHARSET, options); } catch (IOException ex) { throw new RuntimeException(ex); |
void | write(File file, String content) write try { Files.write(file.toPath(), content.getBytes()); } catch (IOException ex) { throw new RuntimeException(ex); |
void | write(File file, String data, boolean append) write Set<OpenOption> options = new HashSet<OpenOption>(); options.add(StandardOpenOption.CREATE); options.add(StandardOpenOption.WRITE); if (append) { options.add(StandardOpenOption.APPEND); } else { options.add(StandardOpenOption.TRUNCATE_EXISTING); write(file, data, options.toArray(new OpenOption[options.size()])); |
void | write(final Map write OutputStream currentStream = new FileOutputStream(currentFile); BufferedOutputStream bufferStream = new BufferedOutputStream(currentStream, BUF_SIZE); DataOutputStream dataStream = new DataOutputStream(bufferStream); long biasing = 0; for (String key : dataBase.keySet()) { biasing += key.getBytes(StandardCharsets.UTF_8).length + POS_STEP; List<String> values = new ArrayList<String>(dataBase.keySet().size()); ... |
void | write(final Object o, final String filename) write to gzip file. try (final BufferedWriter bw = setUpWriter(filename)) { bw.write(MAPPER.writeValueAsString(o)); bw.close(); |
void | write(final OutputStream outputStream, final String string) write write(outputStream, string.getBytes(DEFAULT_CHARSET)); |
void | write(final StringBuffer data, final Writer output) Writes chars from a StringBuffer to a Writer .
if (data != null) {
output.write(data.toString());
|
void | write(OutputStream stream, String string) write Writer out = new OutputStreamWriter(stream, Charset.forName("utf8")); out.write(string); out.flush(); |
void | write(String content, String file) write try (BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(file), Charset.defaultCharset()))) { writer.write(content); |
File | write(String location, String content) write File file = new File(location); file.getParentFile().mkdirs(); Files.write(content, file, Charset.defaultCharset()); return file; |