Overview | Package | Class | Deprecated | Index | Help
| Groovy 1.7.6
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## groovy.ui
[Java] Class SystemOutputInterceptor

    java.lang.Object
      java.io.OutputStream
          java.io.FilterOutputStream
              groovy.ui.SystemOutputInterceptor

    public class SystemOutputInterceptor
    extends FilterOutputStream

Intercepts System.out/System.err. Implementation helper for Console.groovy.

Version:
  \$Id: SystemOutputInterceptor.java 20589 2010-07-31 03:25:47Z paulk \$

Constructor Summary
`SystemOutputInterceptor(Closure callback)` Constructor
`SystemOutputInterceptor(Closure callback, boolean output)` Constructor

Method Summary
`void` | `start()` Starts intercepting System.out/System.err
`void` | `stop()` Stops intercepting System.out/System.err, sending output to whereever it was going when this interceptor was created.
`void` | `write(byte[] b, int off, int len)` Intercepts output - moret common case of byte[]
`void` | `write(int b)` Intercepts output - single characters

Methods inherited from class FilterOutputStream
write, write, write, flush, close, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Methods inherited from class OutputStream
write, write, write, flush, close, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

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

Constructor Detail

### SystemOutputInterceptor

    public SystemOutputInterceptor(Closure callback)

  Constructor
  Parameters:
    `callback` - accepts a string to be sent to std out and returns a Boolean. If the return value is true, output will be sent to System.out, otherwise it will not.

### SystemOutputInterceptor

    public SystemOutputInterceptor(Closure callback, boolean output)

  Constructor
  Parameters:
    `callback` - accepts a string to be sent to std out and returns a Boolean. If the return value is true, output will be sent to System.out/System.err, otherwise it will not.
    `output` - flag that tells whether System.out needs capturing ot System.err

Method Detail

### start

    public void start()

  Starts intercepting System.out/System.err

### stop

    public void stop()

  Stops intercepting System.out/System.err, sending output to whereever it was going when this interceptor was created.

### write

    public void write(byte[] b, int off, int len)

  Intercepts output - moret common case of byte[]

### write

    public void write(int b)

  Intercepts output - single characters

Copyright © 2003-2010 The Codehaus. All rights reserved.