public class OutputCapture
extends java.lang.Object
| Constructor and Description |
|---|
OutputCapture() |
| Modifier and Type | Method and Description |
|---|---|
static void |
deregister()
Deregister streams for the current thread, and restore the previous if any.
|
static void |
install(StreamPair system)
Possibly installs delegating print streams.
|
static void |
register(java.io.PrintStream out,
java.io.PrintStream err)
Register streams for the current thread.
|
static void |
uninstall()
Possibly restores the original print streams.
|
public static void install(StreamPair system)
Checks whether the current thread is the first thread to install
output capturing. If true, the original print streams will
be overwritten by custom, delegating print streams.
In any case this method stores the specified system stream
pair, so that it can be successfully restored later on.
system - A stream pair containing the original system streams.register(PrintStream, PrintStream)public static void uninstall()
Checks whether the current thread is the last thread which previously
installed output capturing. If true, then the original print
streams will be restored.
install(StreamPair)public static void register(java.io.PrintStream out,
java.io.PrintStream err)
out - The standard output stream which is to be registered.err - The error stream which is to be registered.java.lang.IllegalStateException - If output capturing has not been installed.public static void deregister()