List of utility methods to do OutputStreamWriter Write
void | saveTxt(OutputStream os, List save Txt try { OutputStreamWriter fw = newOutputStreamWriter(os); BufferedWriter bw = new BufferedWriter(fw); for (T element : list) { bw.write(element + "\n"); bw.flush(); bw.close(); ... |
void | saveUnicodeStringToFile(final String string, final File file) Save unicode string to file. final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF8")); bw.write(string); bw.flush(); bw.close(); |
void | saveUtfFileWithBOM(File file, String content) save Utf File With BOM BufferedWriter bw = null; OutputStreamWriter osw = null; FileOutputStream fos = new FileOutputStream(file); try { if (file.length() < 1) { final byte[] bom = new byte[] { (byte) 0xEF, (byte) 0xBB, (byte) 0xBF }; fos.write(bom); osw = new OutputStreamWriter(fos, "UTF-8"); bw = new BufferedWriter(osw); if (content != null) { bw.write(content); } catch (IOException ex) { throw ex; } finally { try { bw.close(); fos.close(); } catch (Exception ex) { |