List of utility methods to do OutputStreamWriter Write
void | saveListText(String filename, List save List Text Writer writer = null; try { writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "utf-8")); for (double val : array) { writer.write(val + " "); writer.write("\n"); } catch (IOException ex) { ... |
void | saveLongTxtList(long[] ids, String[] texts, String listFile) save Long Txt List BufferedWriter bw = new BufferedWriter( new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(listFile)))); for (int i = 0; i < texts.length; i++) { bw.append(ids[i] + SEP + texts[i]); bw.newLine(); bw.flush(); bw.close(); ... |
void | saveString(File f, String enc, String text) save String OutputStreamWriter osw = null; try { osw = new OutputStreamWriter(new FileOutputStream(f), enc); osw.write(text); osw.flush(); } finally { if (osw != null) { osw.close(); ... |
void | saveString(String string, File file, String charsetName) save String OutputStream out = new FileOutputStream(file); try { saveString(string, out, charsetName); } finally { out.close(); |
boolean | saveString2File(String s, String filename) save String File return saveString2File(s, new File(filename)); |
boolean | saveStringToFile(String filename, String string) save String To File boolean saved = false; BufferedWriter bw = null; if (string == null || filename == null) { throw new NullPointerException("Null String"); try { bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filename), "UTF-8")); try { ... |
void | saveStringToFile(String toSave, String fn) Save the specifed string to the given file name BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fn))); java.util.StringTokenizer st = new java.util.StringTokenizer(toSave, "\n", true); String s; while (st.hasMoreTokens()) { s = st.nextToken(); if (s.equals("\n")) writer.newLine(); else ... |
void | saveStringToPath(String stringToSave, String pathToSaveTo) save String To Path try { OutputStreamWriter oos = new OutputStreamWriter(new FileOutputStream(pathToSaveTo)); oos.write(stringToSave); oos.close(); } catch (IOException e) { e.printStackTrace(); |
void | saveText(BufferedWriter writer, String string) Saves the given text to the specified BufferedWriter instance, then closes the writer afterwards. writer.write(string); writer.flush(); writer.close(); |
void | saveTextInFile(File file, String content, String encoding) Saves given text content to given file. BufferedWriter bw = null; try { bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), encoding)); bw.write(content); } catch (IOException ex) { throw new RuntimeException(ex.getMessage(), ex); } finally { if (bw != null) { ... |