SystemOutputInterceptor (groovy 2.4.5 API)
Date: 2015-09-17

Package: groovy.ui

## [Java] Class SystemOutputInterceptor

- groovy.ui.SystemOutputInterceptor

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

- - ### Constructor Summary

    Constructors
    Constructor and description
    `SystemOutputInterceptor (Closure callback)` Constructor
    `SystemOutputInterceptor (Closure callback, boolean output)` Constructor

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `void` | `start()` Starts intercepting System.out/System.err
    `void` | `stop()` Stops intercepting System.out/System.err, sending output to wherever 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

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class FilterOutputStream` | `write, write, write, close, flush, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`
    `class OutputStream` | `write, write, write, close, flush, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Constructor Detail

    - #### 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.

    - #### 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

    - #### public void start()

      Starts intercepting System.out/System.err

    - #### public void stop()

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

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

      Intercepts output - moret common case of byte[]

    - #### public void write(int b)

      Intercepts output - single characters