/** * @see java.io.PrintStream#println(boolean) */ public void println(boolean x) { getPrintStream().println(x); }
public int run(String tool, String[] args, File workingDir, Map<String, String> env) { ThreadLocalPrintStream system_out = (ThreadLocalPrintStream) System.out; ThreadLocalPrintStream system_err = (ThreadLocalPrintStream) System.err; Injector injector; lock.readLock().lock(); try { injector = injectors.get(tool); } finally { lock.readLock().unlock(); } Main launcher = injector.getInstance(Main.class); SimpleScope requestScope = launcher.getRequestScope(); try { requestScope.enter(); Main.seedInjector(requestScope, tool, args, workingDir, env); TTYInfo tty = injector.getInstance(TTYInfo.class); if (!tty.stdout) { system_out.init(new PrintStream(new AnsiOutputStream(system_out.getPrintStream()))); } if (!tty.stderr) { system_err.init(new PrintStream(new AnsiOutputStream(system_err.getPrintStream()))); } int result = launcher.runApplication(); System.out.flush(); System.err.flush(); return result; } finally { requestScope.exit(); } }
/** * Creates a new InheritedThreadLocalPrintStream * @param defaultPrintStream the PrintStream that will be used if the * current thread has not called init() */ public ThreadLocalPrintStream(PrintStream defaultPrintStream) { super(defaultPrintStream); streams = new InheritableThreadLocal(); this.defaultPrintStream = defaultPrintStream; init(null); }
if (!(System.in instanceof ThreadLocalInputStream)) { System.setIn(new ThreadLocalInputStream(in)); System.setOut(new ThreadLocalPrintStream(out)); System.setErr(new ThreadLocalPrintStream(err));
/** * @see java.io.FilterOutputStream#write(byte[]) */ public void write(byte[] b) throws IOException { getPrintStream().write(b); }
/** * @see java.io.PrintStream#close() */ public void close() { getPrintStream().close(); }
/** * @see java.io.PrintStream#print(double) */ public void print(double d) { getPrintStream().print(d); }
/** * @see java.io.PrintStream#print(long) */ public void print(long l) { getPrintStream().print(l); }
/** * @see java.io.PrintStream#println() */ public void println() { getPrintStream().println(); }
/** * @see java.io.PrintStream#println(float) */ public void println(float x) { getPrintStream().println(x); }
/** * @see java.io.PrintStream#print(boolean) */ public void print(boolean b) { getPrintStream().print(b); }
/** * @see java.io.PrintStream#print(char) */ public void print(char c) { getPrintStream().print(c); }
/** * @see java.io.PrintStream#print(float) */ public void print(float f) { getPrintStream().print(f); }
/** * @see java.io.PrintStream#print(Object) */ public void print(Object obj) { getPrintStream().print(obj); }
/** * @see java.io.PrintStream#println(char) */ public void println(char x) { getPrintStream().println(x); }
/** * @see java.io.PrintStream#println(long) */ public void println(long x) { getPrintStream().println(x); }
/** * @see java.io.PrintStream#write(byte[],int,int) */ public void write(byte[] buf, int off, int len) { getPrintStream().write(buf, off, len); }
/** * @see java.io.PrintStream#flush() */ public void flush() { getPrintStream().flush(); }
/** * @see java.io.PrintStream#println(double) */ public void println(double x) { getPrintStream().println(x); }