List of utility methods to do PrintWriter Write
boolean | saveStringAsFile(String string, String path) save String As File PrintWriter out; try { out = new PrintWriter(path); out.println(string); out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); return false; ... |
void | saveStringBufferTofile(String fileName, StringBuffer sb) save String Buffer Tofile PrintWriter writer = new PrintWriter(fileName, "UTF-8"); try { writer.println(sb); writer.close(); } finally { writer.close(); |
void | saveStrings(final String filename, final String[] sArray) Saves string arrays to files (the assumption being that said file is a collection/list of arbitrary strings in a particular layout try { final File file = new File(filename); final PrintWriter output = new PrintWriter(file); for (final String s : sArray) { output.println(s); output.close(); } catch (Exception e) { ... |
void | saveStrings(String filename, String data[]) ( begin auto-generated from saveStrings.xml ) Writes an array of strings to a file, one line per string. saveStrings(saveFile(filename), data); |
void | saveStrings(String theFilePath, String[] theStrings) save Strings createPath(theFilePath); saveStrings(getOutputStream(theFilePath), theStrings); |
void | saveStringToFile(String text, String path) save String To File PrintWriter writer = null; try { writer = new PrintWriter(path, "UTF-8"); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); writer.write(text); writer.close(); |
void | saveToFile(String buf, String fileName) save To File try (PrintWriter out = new PrintWriter(fileName)) { out.println(buf); } catch (Exception e) { throw new RuntimeException("Failed to write content to file " + fileName, e); |
void | saveToFile(String path, String data) save To File try (PrintWriter writer = new PrintWriter(path)) { writer.println(data); |