List of utility methods to do Text File Write
void | writeFile(File file, String content) writes a file with the given content. Writer w = new FileWriter(file); if (content != null) w.write(content); w.flush(); w.close(); |
void | writeFile(File file, String content, String encoding) write File if (!file.exists()) { file.getParentFile().mkdirs(); FileOutputStream out = null; try { out = new FileOutputStream(file); out.write(content.getBytes(encoding)); } finally { ... |
void | writeFile(File file, String text) write File FileWriter out = null; try { out = new FileWriter(file); out.write(text); } finally { if (out != null) { out.close(); |
boolean | writeFile(File out, String text) write File try { return writeFile(new FileOutputStream(out), text); } catch (Exception e) { e.printStackTrace(); return false; |
boolean | writeFile(OutputStream output, String text) write File OutputStreamWriter out = null; BufferedWriter buffer = null; try { out = new OutputStreamWriter(output); buffer = new BufferedWriter(out); buffer.write(text); } catch (Exception e) { e.printStackTrace(); ... |
void | writeFile(String file, T data, boolean append) write File FileWriter writer = null; try { writer = new FileWriter(file, append); writer.write(data.toString()); writer.flush(); } catch (IOException e) { e.printStackTrace(); } finally { ... |
void | writeFile(String fileName, String content) write File writeFile(fileName, content.getBytes()); |
void | writeFile(String fileName, String text) write File FileWriter fw = new FileWriter(fileName, true); try { fw.write(text, 0, text.length()); } catch (IOException ioe) { throw new IOException("Write text to " + fileName + " fail!"); } finally { fw.close(); |
void | writeFile(String fileName, String text, boolean isAppend) write File FileWriter fw = new FileWriter(fileName, isAppend); try { fw.write(text, 0, text.length()); } catch (IOException ioe) { throw new IOException("Write text to " + fileName + " fail!"); } finally { fw.close(); |
void | writeFile(String filePath, String content) write File FileOutputStream outSTr = new FileOutputStream(new File(filePath)); BufferedOutputStream Buff = new BufferedOutputStream(outSTr); Buff.write(content.getBytes()); Buff.flush(); Buff.close(); |