1 32 package net.sf.retrotranslator.runtime.java.io; 33 34 import java.io.*; 35 import java.util.*; 36 37 40 public class _PrintStream { 41 42 public static class PrintStreamBuilder { 43 44 private OutputStream out; 45 private String encoding; 46 47 protected PrintStreamBuilder(OutputStream out, String encoding) { 48 this.out = out; 49 this.encoding = encoding; 50 } 51 52 public OutputStream argument1() { 53 return out; 54 } 55 56 public boolean argument2() { 57 return false; 58 } 59 60 public String argument3() { 61 return encoding; 62 } 63 } 64 65 public static OutputStream convertConstructorArguments(File file) throws FileNotFoundException { 66 return new FileOutputStream(file); 67 } 68 69 public static OutputStream convertConstructorArguments(String fileName) throws FileNotFoundException { 70 return new FileOutputStream(fileName); 71 } 72 73 public static PrintStreamBuilder createInstanceBuilder(File file, String csn) throws FileNotFoundException { 74 return new PrintStreamBuilder(new FileOutputStream(file), csn); 75 } 76 77 public static PrintStreamBuilder createInstanceBuilder(String fileName, String csn) throws FileNotFoundException { 78 return new PrintStreamBuilder(new FileOutputStream(fileName), csn); 79 } 80 81 public static PrintStream append(PrintStream printStream, CharSequence csq) { 82 printStream.print(csq); 83 return printStream; 84 } 85 86 public static PrintStream append(PrintStream printStream, CharSequence csq, int start, int end) { 87 printStream.print(String.valueOf(csq).substring(start, end)); 88 return printStream; 89 } 90 91 public static PrintStream append(PrintStream printStream, char c) { 92 printStream.print(c); 93 return printStream; 94 } 95 96 public static PrintStream format(PrintStream printStream, Locale locale, String format, Object ... args) { 97 new Formatter(printStream, locale).format(format, args); 98 return printStream; 99 } 100 101 public static PrintStream format(PrintStream printStream, String format, Object ... args) { 102 new Formatter(printStream).format(format, args); 103 return printStream; 104 } 105 106 public static PrintStream printf(PrintStream printStream, Locale locale, String format, Object ... args) { 107 return format(printStream, locale, format, args); 108 } 109 110 public static PrintStream printf(PrintStream printStream, String format, Object ... args) { 111 return format(printStream, format, args); 112 } 113 114 } 115 | Popular Tags |