Griffon 1.2.0

org.codehaus.griffon.test.io
[Groovy] Class SystemOutAndErrSwapper

java.lang.Object
  org.codehaus.griffon.test.io.SystemOutAndErrSwapper

class SystemOutAndErrSwapper

Convenience class to temporarily swap in an output stream for standard error and standard out.


Field Summary
protected boolean swapped

protected PrintStream swappedInErr

protected OutputStream swappedInErrStream

protected PrintStream swappedInOut

protected OutputStream swappedInOutStream

protected PrintStream swappedOutErr

protected PrintStream swappedOutOut

 
Property Summary
boolean echoErr

boolean echoOut

 
Constructor Summary
SystemOutAndErrSwapper(boolean echoOut = false, boolean echoErr = false)

 
Method Summary
List swapIn()

Replaces System.out and System.err with PrintStream's wrapping outStream and errStream

List swapIn(OutputStream outStream, OutputStream errStream)

Replaces System.out and System.err with PrintStream's wrapping outStream and errStream

List swapOut()

Restores System.out and System.err to what they were before swappedIn() was called.

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Field Detail

swapped

protected boolean swapped


swappedInErr

protected PrintStream swappedInErr


swappedInErrStream

protected OutputStream swappedInErrStream


swappedInOut

protected PrintStream swappedInOut


swappedInOutStream

protected OutputStream swappedInOutStream


swappedOutErr

protected PrintStream swappedOutErr


swappedOutOut

protected PrintStream swappedOutOut


 
Property Detail

echoErr

final boolean echoErr


echoOut

final boolean echoOut


 
Constructor Detail

SystemOutAndErrSwapper

SystemOutAndErrSwapper(boolean echoOut = false, boolean echoErr = false)


 
Method Detail

swapIn

List swapIn()
Replaces System.out and System.err with PrintStream's wrapping outStream and errStream
throws:
IllegalStateException if a swap is already on
Returns:
[outStream , errStream]


swapIn

List swapIn(OutputStream outStream, OutputStream errStream)
Replaces System.out and System.err with PrintStream's wrapping outStream and errStream
throws:
IllegalStateException if a swap is already on
Returns:
[outStream , errStream]


swapOut

List swapOut()
Restores System.out and System.err to what they were before swappedIn() was called.
throws:
IllegalStateException if not in a swap
Returns:
the underlying output streams for the swap ([out, err])


 

Groovy Documentation