List of utility methods to do OutputStreamWriter Write
void | save(String fileContent, File file, String encoding) Saves a string to a text file. FileOutputStream fos = new FileOutputStream(file); OutputStreamWriter writer = new OutputStreamWriter(fos, encoding); try { writer.write(fileContent); writer.flush(); } finally { fos.close(); |
void | save(String text, File out) Creates file with given text BufferedWriter bw = new BufferedWriter( new OutputStreamWriter(new DataOutputStream(new FileOutputStream(out)))); bw.write(text); bw.close(); |
boolean | saveCache() save Cache String data = ""; Iterator<String> keyIterator = cache.keySet().iterator(); while (keyIterator.hasNext()) { String key = (String) keyIterator.next(); int value = cache.get(key); data += key + "," + value + "\n"; File f = new File("cache.map"); ... |
void | saveDocument(String path, String textToWrite) Method to save a document on a path File f = new File(path); Writer out = null; try { f.createNewFile(); out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f), "UTF-8")); out.write(textToWrite); out.close(); } catch (IOException e) { ... |
void | saveFile(File file, String whatToSave, String encoding) save File if (file.isDirectory()) { throw new IllegalArgumentException("File " + file + " should not be a directory"); try { BufferedWriter output = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(file), encoding)); output.write(whatToSave); output.close(); ... |
void | saveFile(final File file, final String content) save File FileOutputStream fos = new FileOutputStream(file); final Writer writer = new OutputStreamWriter(fos, "UTF-8"); writer.write(content); writer.close(); fos.close(); |
void | saveFile(String content, File f, String encoding) Method to save String as file in specified encoding/. try (Writer output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f), encoding))) { output.write(content); output.flush(); |
void | saveFile(String fname, String text, String encode) save File OutputStreamWriter ow = new OutputStreamWriter(new FileOutputStream(fname), encode); ow.write(text); ow.close(); |
void | saveFile(String path, String msg) save File FileOutputStream fos = new FileOutputStream(new File(path)); OutputStreamWriter osw = new OutputStreamWriter(fos); osw.write(msg); osw.flush(); osw.close(); |
void | saveListString(List save List String BufferedWriter out; try { out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF8")); for (int i = 0; i < list.size(); i++) { out.write((String) list.get(i) + "\n"); out.close(); } catch (IOException ex) { ... |