List of utility methods to do PrintWriter Create
PrintWriter | getPrintWriter(File f) Get a PrintWriter for the specified file, throw RuntimeExcpetion if any problems. try { return new PrintWriter(new FileOutputStream(f)); } catch (Exception ex) { throw new RuntimeException(ex); |
PrintWriter | getPrintWriter(File file) get Print Writer Writer osWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"), 16384); PrintWriter pw = new PrintWriter(osWriter, false); return pw; |
PrintWriter | getPrintWriter(File file) Init. if (file.getName().endsWith(".gz")) { return new PrintWriter(new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(file)))); return new PrintWriter(file); |
PrintWriter | getPrintwriter(File file, boolean append) Return print writer for file with UTF8 encoding. OutputStream os = new FileOutputStream(file, append); if (file.getName().endsWith(".gz")) { os = new GZIPOutputStream(os); return new PrintWriter(new OutputStreamWriter(os, "UTF8")); |
PrintWriter | getPrintWriter(final File aFile, final boolean append) get Print Writer final FileWriter resFileOut = new FileWriter(aFile, append); PrintWriter ret = new PrintWriter(resFileOut); return ret; |
PrintWriter | getPrintWriter(String filename) getPrintWriter if (filename == "") { return null; if (filename.equals("-")) { return new PrintWriter(System.out); File outputFile = new File(filename); if (outputFile.exists() && !outputFile.canWrite()) { ... |
PrintWriter | getPrintWriter(String fileName, Writer out) get Print Writer if (fileName == null) return null; Writer writer = fileName.equals("-") ? out : new BufferedWriter(new FileWriter(fileName)); return new PrintWriter(writer); |
PrintWriter | getPrintWriter(String nombreFichero) get Print Writer PrintWriter printWriter; FileWriter fileWriter; fileWriter = new FileWriter(nombreFichero); printWriter = new PrintWriter(fileWriter); return printWriter; |
PrintWriter | getPrintWriter(String path, String charset, boolean isAppend) get Print Writer return new PrintWriter(getBufferedWriter(path, charset, isAppend)); |