Package groovy.ui
Class SystemOutputInterceptor
- java.lang.Object
- 
- java.io.OutputStream
- 
- java.io.FilterOutputStream
- 
- groovy.ui.SystemOutputInterceptor
 
 
 
- 
- All Implemented Interfaces:
- Closeable,- Flushable,- AutoCloseable
 
 @Deprecated public class SystemOutputInterceptor extends FilterOutputStream Deprecated.Intercepts System.out/System.err. Implementation helper for Console.groovy.
- 
- 
Field Summary- 
Fields inherited from class java.io.FilterOutputStreamout
 
- 
 - 
Constructor SummaryConstructors Constructor Description SystemOutputInterceptor(Closure callback)Deprecated.ConstructorSystemOutputInterceptor(Closure callback, boolean output)Deprecated.Constructor
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidremoveConsoleId()Deprecated.Threads executing a script should call this method after execution completes in order to unregister the consoleId.voidsetConsoleId(int consoleId)Deprecated.Threads executing a script should call this method at the start of execution in order to set the id of the console that is hosting the thread of execution.voidstart()Deprecated.Starts intercepting System.out/System.errvoidstop()Deprecated.Stops intercepting System.out/System.err, sending output to wherever it was going when this interceptor was created.voidwrite(byte[] b, int off, int len)Deprecated.Intercepts output - more common case of byte[]voidwrite(int b)Deprecated.Intercepts output - single characters- 
Methods inherited from class java.io.FilterOutputStreamclose, flush, write
 - 
Methods inherited from class java.io.OutputStreamnullOutputStream
 
- 
 
- 
- 
- 
Constructor Detail- 
SystemOutputInterceptorpublic SystemOutputInterceptor(Closure callback) Deprecated.Constructor- Parameters:
- callback- accepts the id of the target Console instance and 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.
 
 - 
SystemOutputInterceptorpublic SystemOutputInterceptor(Closure callback, boolean output) Deprecated.Constructor- Parameters:
- callback- accepts the id of the target Console instance and 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- 
startpublic void start() Deprecated.Starts intercepting System.out/System.err
 - 
stoppublic void stop() Deprecated.Stops intercepting System.out/System.err, sending output to wherever it was going when this interceptor was created.
 - 
writepublic void write(byte[] b, int off, int len) throws IOExceptionDeprecated.Intercepts output - more common case of byte[]- Overrides:
- writein class- FilterOutputStream
- Throws:
- IOException
 
 - 
writepublic void write(int b) throws IOExceptionDeprecated.Intercepts output - single characters- Overrides:
- writein class- FilterOutputStream
- Throws:
- IOException
 
 - 
setConsoleIdpublic void setConsoleId(int consoleId) Deprecated.Threads executing a script should call this method at the start of execution in order to set the id of the console that is hosting the thread of execution. This should be called prior to any output that is generated. The consoleId will be passed to the callback.- Parameters:
- consoleId- id of the Console instance executing the script
 
 - 
removeConsoleIdpublic void removeConsoleId() Deprecated.Threads executing a script should call this method after execution completes in order to unregister the consoleId.
 
- 
 
-