@groovy.transform.CompileStatic class SystemOutAndErrSwapper extends java.lang.Object
Convenience class to temporarily swap in an output stream for standard error and standard out.
| Modifiers | Name | Description |
|---|---|---|
static class |
SystemOutAndErrSwapper.TestOutputCapturingPrintStream |
Captures everything written to the swapped stream. |
| Modifiers | Name | Description |
|---|---|---|
protected boolean |
swapped |
|
protected java.io.PrintStream |
swappedInErr |
|
protected java.io.OutputStream |
swappedInErrStream |
|
protected java.io.PrintStream |
swappedInOut |
|
protected java.io.OutputStream |
swappedInOutStream |
|
protected java.io.PrintStream |
swappedOutErr |
|
protected java.io.PrintStream |
swappedOutOut |
| Type | Name and description |
|---|---|
static java.lang.String |
SUSPEND_CONSOLE_REDIRECTMirrors grails.build.logging.GrailsConsole.SUSPEND_SYSTEM_OUT_REDIRECT. |
boolean |
echoErr |
boolean |
echoOut |
| Constructor and description |
|---|
SystemOutAndErrSwapper(boolean echoOut, boolean echoErr) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
boolean |
isSwapped() |
|
java.util.List<java.io.OutputStream> |
swapIn()Replaces System.out and System.err with PrintStream's wrapping outStream and errStream |
|
java.util.List<java.io.OutputStream> |
swapIn(java.io.OutputStream outStream, java.io.OutputStream errStream)Replaces System.out and System.err with PrintStream's wrapping outStream and errStream |
|
java.util.List<java.io.OutputStream> |
swapOut()Restores System.out and System.err to what they were before swappedIn() was called. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Mirrors grails.build.logging.GrailsConsole.SUSPEND_SYSTEM_OUT_REDIRECT. Declared as a
literal rather than a reference because the console ships in the cli tier, which is deliberately
absent from an application's production and test compile classpath.
Replaces System.out and System.err with PrintStream's wrapping outStream and errStream
Replaces System.out and System.err with PrintStream's wrapping outStream and errStream
Restores System.out and System.err to what they were before swappedIn() was called.