Groovy JDK

java.lang
Class Process

Method Summary
void consumeProcessErrorStream(StringBuffer error)
Gets the error stream from a process and reads it to keep the process from blocking due to a full buffer The processed stream data is appended to the supplied StringBuffer A new Thread is started, so this method will return immediately
void consumeProcessErrorStream(OutputStream err)
Gets the error stream from a process and reads it to keep the process from blocking due to a full buffer The processed stream data is appended to the supplied OutputStream A new Thread is started, so this method will return immediately
void consumeProcessErrorStream(Writer err)
Gets the error stream from a process and reads it to keep the process from blocking due to a full buffer The processed stream data is appended to the supplied Writer A new Thread is started, so this method will return immediately
void consumeProcessOutput()
Gets the output and error streams from a process and reads them to keep the process from blocking due to a full output buffer two Threads are started, so this method will return immediately
void consumeProcessOutput(StringBuffer output, StringBuffer error)
Gets the output and error streams from a process and reads them to keep the process from blocking due to a full output buffer The processed stream data is appended to the supplied StringBuffer For this, two Threads are started, so this method will return immediately
void consumeProcessOutput(OutputStream output, OutputStream error)
Gets the output and error streams from a process and reads them to keep the process from blocking due to a full output buffer The processed stream data is appended to the supplied OutputStream For this, two Threads are started, so this method will return immediately
void consumeProcessOutputStream(StringBuffer output)
Gets the output stream from a process and reads it to keep the process from blocking due to a full output buffer The processed stream data is appended to the supplied StringBuffer A new Thread is started, so this method will return immediately
void consumeProcessOutputStream(OutputStream output)
Gets the output stream from a process and reads it to keep the process from blocking due to a full output buffer The processed stream data is appended to the supplied OutputStream A new Thread is started, so this method will return immediately
void consumeProcessOutputStream(Writer output)
Gets the output stream from a process and reads it to keep the process from blocking due to a full output buffer The processed stream data is appended to the supplied Writer A new Thread is started, so this method will return immediately
InputStream getErr()
An alias method so that a process appears similar to System you can use process
InputStream getIn()
An alias method so that a process appears similar to System you can use process
OutputStream getOut()
An alias method so that a process appears similar to System you can use process
String getText()
Read the text of the output stream of the Process
Writer leftShift(Object value)
Overloads the left shift operator (<<) to provide an append mechanism to pipe data to a Process
OutputStream leftShift(byte[] value)
Overloads the left shift operator to provide an append mechanism to pipe into a Process
Process or(Process right)
Overrides the or operator to allow one Process to asynchronously pipe data to another Process
Process pipeTo(Process right)
Allows one Process to asynchronously pipe data to another Process
void waitForOrKill(long numberOfMillis)
Wait for the process to finish during a certain amount of time, otherwise stops the process
void withOutputStream(Closure closure)
Creates a new buffered OutputStream as stdin for this process, passes it to the closure, and ensures the stream is flushed and closed after the closure returns A new Thread is started, so this method will return immediately
void withWriter(Closure closure)
Creates a new BufferedWriter as stdin for this process, passes it to the closure, and ensures the stream is flushed and closed after the closure returns A new Thread is started, so this method will return immediately
 
Method Detail

consumeProcessErrorStream

public void consumeProcessErrorStream(StringBuffer error)
Gets the error stream from a process and reads it to keep the process from blocking due to a full buffer. The processed stream data is appended to the supplied StringBuffer. A new Thread is started, so this method will return immediately.

Parameters:
error - a StringBuffer to capture the process stderr.

consumeProcessErrorStream

public void consumeProcessErrorStream(OutputStream err)
Gets the error stream from a process and reads it to keep the process from blocking due to a full buffer. The processed stream data is appended to the supplied OutputStream. A new Thread is started, so this method will return immediately.

Parameters:
err - an OutputStream to capture the process stderr.

consumeProcessErrorStream

public void consumeProcessErrorStream(Writer err)
Gets the error stream from a process and reads it to keep the process from blocking due to a full buffer. The processed stream data is appended to the supplied Writer. A new Thread is started, so this method will return immediately.

Parameters:
err - a Writer to capture the process stderr.

consumeProcessOutput

public void consumeProcessOutput()
Gets the output and error streams from a process and reads them to keep the process from blocking due to a full output buffer. For this, two Threads are started, so this method will return immediately.


consumeProcessOutput

public void consumeProcessOutput(StringBuffer output, StringBuffer error)
Gets the output and error streams from a process and reads them to keep the process from blocking due to a full output buffer. The processed stream data is appended to the supplied StringBuffer. For this, two Threads are started, so this method will return immediately.

Parameters:
output - a StringBuffer to capture the process stdout.
error - a StringBuffer to capture the process stderr.

consumeProcessOutput

public void consumeProcessOutput(OutputStream output, OutputStream error)
Gets the output and error streams from a process and reads them to keep the process from blocking due to a full output buffer. The processed stream data is appended to the supplied OutputStream. For this, two Threads are started, so this method will return immediately.

Parameters:
output - an OutputStream to capture the process stdout.
error - an OutputStream to capture the process stderr.

consumeProcessOutputStream

public void consumeProcessOutputStream(StringBuffer output)
Gets the output stream from a process and reads it to keep the process from blocking due to a full output buffer. The processed stream data is appended to the supplied StringBuffer. A new Thread is started, so this method will return immediately.

Parameters:
output - a StringBuffer to capture the process stdout.

consumeProcessOutputStream

public void consumeProcessOutputStream(OutputStream output)
Gets the output stream from a process and reads it to keep the process from blocking due to a full output buffer. The processed stream data is appended to the supplied OutputStream. A new Thread is started, so this method will return immediately.

Parameters:
output - an OutputStream to capture the process stdout.

consumeProcessOutputStream

public void consumeProcessOutputStream(Writer output)
Gets the output stream from a process and reads it to keep the process from blocking due to a full output buffer. The processed stream data is appended to the supplied Writer. A new Thread is started, so this method will return immediately.

Parameters:
output - a Writer to capture the process stdout.

getErr

public InputStream getErr()
An alias method so that a process appears similar to System.out, System.in, System.err; you can use process.in, process.out, process.err in a similar fashion.

Returns:
the error InputStream for the process

getIn

public InputStream getIn()
An alias method so that a process appears similar to System.out, System.in, System.err; you can use process.in, process.out, process.err in a similar fashion.

Returns:
the InputStream for the process

getOut

public OutputStream getOut()
An alias method so that a process appears similar to System.out, System.in, System.err; you can use process.in, process.out, process.err in a similar fashion.

Returns:
the OutputStream for the process

getText

public String getText()
Read the text of the output stream of the Process.

Returns:
the text of the output

leftShift

public Writer leftShift(Object value)
Overloads the left shift operator (<<) to provide an append mechanism to pipe data to a Process.

Parameters:
value - a value to append.
Returns:
a Writer

leftShift

public OutputStream leftShift(byte[] value)
Overloads the left shift operator to provide an append mechanism to pipe into a Process

Parameters:
value - data to append.
Returns:
an OutputStream

or

public Process or(Process right)
Overrides the or operator to allow one Process to asynchronously pipe data to another Process.

Parameters:
right - a Process to pipe output to.
Returns:
the second Process to allow chaining

pipeTo

public Process pipeTo(Process right)
Allows one Process to asynchronously pipe data to another Process.

Parameters:
right - a Process to pipe output to.
Returns:
the second Process to allow chaining

waitForOrKill

public void waitForOrKill(long numberOfMillis)
Wait for the process to finish during a certain amount of time, otherwise stops the process.

Parameters:
numberOfMillis - the number of milliseconds to wait before stopping the process.

withOutputStream

public void withOutputStream(Closure closure)
Creates a new buffered OutputStream as stdin for this process, passes it to the closure, and ensures the stream is flushed and closed after the closure returns. A new Thread is started, so this method will return immediately.

Parameters:
closure - a closure.

withWriter

public void withWriter(Closure closure)
Creates a new BufferedWriter as stdin for this process, passes it to the closure, and ensures the stream is flushed and closed after the closure returns. A new Thread is started, so this method will return immediately.

Parameters:
closure - a closure.

Groovy JDK