1 32 package net.sf.retrotranslator.runtime.java.io; 33 34 import java.io.*; 35 import java.util.*; 36 37 40 public class _PrintWriter { 41 42 public static Writer convertConstructorArguments(File file) throws FileNotFoundException { 43 return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file))); 44 } 45 46 public static Writer convertConstructorArguments(File file, String csn) 47 throws FileNotFoundException, UnsupportedEncodingException { 48 return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), csn)); 49 } 50 51 public static Writer convertConstructorArguments(String fileName) throws FileNotFoundException { 52 return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName))); 53 } 54 55 public static Writer convertConstructorArguments(String fileName, String csn) 56 throws FileNotFoundException, UnsupportedEncodingException { 57 return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), csn)); 58 } 59 60 public static PrintWriter append(PrintWriter writer, CharSequence csq) { 61 writer.write(String.valueOf(csq)); 62 return writer; 63 } 64 65 public static PrintWriter append(PrintWriter writer, CharSequence csq, int start, int end) { 66 writer.write(String.valueOf(csq).substring(start, end)); 67 return writer; 68 } 69 70 public static PrintWriter append(PrintWriter writer, char c) { 71 writer.write(c); 72 return writer; 73 } 74 75 public static PrintWriter format(PrintWriter printWriter, Locale locale, String format, Object ... args) { 76 new Formatter(printWriter, locale).format(format, args); 77 printWriter.flush(); 78 return printWriter; 79 } 80 81 public static PrintWriter format(PrintWriter printWriter, String format, Object ... args) { 82 new Formatter(printWriter).format(format, args); 83 printWriter.flush(); 84 return printWriter; 85 } 86 87 public static PrintWriter printf(PrintWriter printWriter, Locale locale, String format, Object ... args) { 88 return format(printWriter, locale, format, args); 89 } 90 91 public static PrintWriter printf(PrintWriter printWriter, String format, Object ... args) { 92 return format(printWriter, format, args); 93 } 94 95 } 96 | Popular Tags |