List of utility methods to do Write String to File
void | writeFile(File file, String contents) Store the contents of a String in a file. writeFile(file.getAbsolutePath(), contents); |
void | writeFile(File file, String contents) write File BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file))); try { writer.write(contents); } finally { writer.close(); |
void | writeFile(File file, String data) Write a String to a file. PrintWriter out = openForWriting(file); try { out.print(data); } finally { out.close(); |
void | writeFile(File file, String data) write File try (FileWriter writer = new FileWriter(file)) { writer.write(data); |
void | writeFile(File file, String data) Writes String data to the given path (UTF-8). writeFile(file, data.getBytes("UTF-8"));
|
void | writeFile(File file, String data, boolean append) write File try { FileOutputStream fos = new FileOutputStream(file, append); fos.write(data.getBytes()); fos.close(); } catch (Exception e) { |
boolean | writeFile(File file, String dataString) Writes a string to a file; try { PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(file))); out.print(dataString); out.flush(); out.close(); } catch (IOException e) { return false; return true; |
boolean | writeFile(File file, String text) Write to File return writeFile(file.toString(), text);
|
void | writeFile(File file, String text) write File writeFile(file, text, false); |
void | writeFile(File file, String... lines) write File BufferedWriter writer = new BufferedWriter(new FileWriter(file)); for (String line : lines) { writer.append(line); writer.newLine(); writer.close(); |