public class ThreadLocalPrintStream extends DelegatingPrintStream
Modifier and Type | Class and Description |
---|---|
static class |
ThreadLocalPrintStream.OutputCapturingContext |
Constructor and Description |
---|
ThreadLocalPrintStream(java.io.PrintStream defaultPrintStream) |
Modifier and Type | Method and Description |
---|---|
ThreadLocalPrintStream.OutputCapturingContext |
capture()
creates a capturing context which eats the output to this stream, blocking the original target
|
ThreadLocalPrintStream.OutputCapturingContext |
captureTee()
creates a capturing context which sees the output to this stream, without interrupting the original target
|
java.io.PrintStream |
clearThreadLocalPrintStream() |
java.io.PrintStream |
getDelegate() |
java.io.PrintStream |
setThreadLocalPrintStream(java.io.OutputStream stream)
sets the PrintStream that callers from this thread should see;
returns any previously custom PrintStream for this thread
|
static ThreadLocalPrintStream |
stderr()
installs a thread local print stream to System.err if one is not already set;
caller may then #capture and #captureTee on it.
|
static ThreadLocalPrintStream |
stdout()
installs a thread local print stream to System.out if one is not already set;
caller may then #capture and #captureTee on it.
|
append, append, append, checkError, close, equals, flush, format, format, hashCode, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, toString, write, write, write
public ThreadLocalPrintStream(java.io.PrintStream defaultPrintStream)
public java.io.PrintStream getDelegate()
public java.io.PrintStream setThreadLocalPrintStream(java.io.OutputStream stream)
public java.io.PrintStream clearThreadLocalPrintStream()
public ThreadLocalPrintStream.OutputCapturingContext capture()
public ThreadLocalPrintStream.OutputCapturingContext captureTee()
public static ThreadLocalPrintStream stdout()
public static ThreadLocalPrintStream stderr()