List of utility methods to do BufferedWriter Create
BufferedWriter | getBufferedWriter(File f) get Buffered Writer try { if (writers.containsKey(f)) { return writers.get(f); } else { BufferedWriter returns = new BufferedWriter(new FileWriter(f, true)); writers.put(f, returns); return returns; } catch (Exception e) { e.printStackTrace(); return null; |
BufferedWriter | getBufferedWriter(File file) Creates a buffered writer for a specified file. FileOutputStream fos = new FileOutputStream(file); OutputStreamWriter osw = new OutputStreamWriter(fos); BufferedWriter bw = new BufferedWriter(osw); return bw; |
BufferedWriter | getBufferedWriter(final Writer out) Retrieves a BufferedWriter for the given Writer return out instanceof BufferedWriter ? (BufferedWriter) out : new BufferedWriter(out); |
BufferedWriter | getBufferedWriter(OutputStream os) get Buffered Writer return new BufferedWriter(new OutputStreamWriter(os)); |
BufferedWriter | getBufferedWriter(String directory, String filename) Returns a BufferedWriter. return getBufferedWriter(directory, filename, false);
|
BufferedWriter | getBufferedWriter(String file) get Buffered Writer BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(file)); } catch (Exception e) { return writer; |
BufferedWriter | getBufferedWriter(String file, String fileCharset) Get the buffered writer BufferedWriter fs = null; if (fileCharset != null && fileCharset.trim().length() > 0) { fs = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), fileCharset.trim())); } else { fs = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file))); return fs; |
BufferedWriter | getBufferedWriter(String filePath, String encoding) get Buffered Writer return getBufferedWriter(filePath, encoding, false);
|
BufferedWriter | getBufferedWriter(String path) get Buffered Writer FileOutputStream fileOutputStream = new FileOutputStream(path); OutputStreamWriter out = new OutputStreamWriter(fileOutputStream, "utf-8"); return new BufferedWriter(out); |
BufferedWriter | getBufferedWriter(String path, String charset, boolean isAppend) get Buffered Writer return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(touch(path), isAppend), charset)); |