Groovy JDK

java.lang
Class Process

Method Summary
Thread consumeProcessErrorStream(OutputStream err)
Thread consumeProcessErrorStream(StringBuffer error)
Thread consumeProcessErrorStream(Writer err)
Thread consumeProcessErrorStream(OutputStream err)
Gets the error stream from a process and reads it to keep the process from blocking due to a full buffer.
Thread consumeProcessErrorStream(Appendable error)
Gets the error stream from a process and reads it to keep the process from blocking due to a full buffer.
void consumeProcessOutput()
void consumeProcessOutput(StringBuffer output, StringBuffer error)
void consumeProcessOutput(OutputStream output, OutputStream error)
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.
void consumeProcessOutput(Appendable output, Appendable 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.
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.
Thread consumeProcessOutputStream(StringBuffer output)
Thread consumeProcessOutputStream(Writer output)
Thread consumeProcessOutputStream(OutputStream output)
Thread consumeProcessOutputStream(Appendable output)
Gets the output stream from a process and reads it to keep the process from blocking due to a full output buffer.
Thread 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.
InputStream getErr()
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.
InputStream getIn()
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.
OutputStream getOut()
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.
String getText()
String getText()
Read the text of the output stream of the Process.
Writer leftShift(Object value)
OutputStream leftShift(byte[] value)
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)
Process or(Process right)
Overrides the or operator to allow one Process to asynchronously pipe data to another Process.
Process pipeTo(Process right)
Process pipeTo(Process right)
Allows one Process to asynchronously pipe data to another Process.
void waitForOrKill(long numberOfMillis)
void waitForOrKill(long numberOfMillis)
Wait for the process to finish during a certain amount of time, otherwise stops the process.
void waitForProcessOutput()
void waitForProcessOutput(StringBuffer output, StringBuffer error)
void waitForProcessOutput(OutputStream output, OutputStream error)
void waitForProcessOutput()
Gets the output and error streams from a process and reads them to keep the process from blocking due to a full output buffer.
void waitForProcessOutput(Appendable output, Appendable 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.
void waitForProcessOutput(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.
void withOutputStream(Closure closure)
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.
void withWriter(Closure closure)
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.
 
Method Detail

consumeProcessErrorStream

public Thread consumeProcessErrorStream(OutputStream err)
 
Parameters:

consumeProcessErrorStream

public Thread consumeProcessErrorStream(StringBuffer error)
 
Parameters:

consumeProcessErrorStream

public Thread consumeProcessErrorStream(Writer err)
 
Parameters:

consumeProcessErrorStream

public Thread 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.
Returns:
the Thread
Since:
1.5.2

consumeProcessErrorStream

public Thread consumeProcessErrorStream(Appendable 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 Appendable. A new Thread is started, so this method will return immediately.
Parameters:
error - an Appendable to capture the process stderr.
Returns:
the Thread
Since:
1.7.5

consumeProcessOutput

public void consumeProcessOutput()
 

consumeProcessOutput

public void consumeProcessOutput(StringBuffer output, StringBuffer error)
 
Parameters:

consumeProcessOutput

public void consumeProcessOutput(OutputStream output, OutputStream error)
 
Parameters:

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. The stream data is thrown away but blocking due to a full output buffer is avoided. Use this method if you don't care about the standard or error output and just want the process to run silently - use carefully however, because since the stream data is thrown away, it might be difficult to track down when something goes wrong. For this, two Threads are started, so this method will return immediately.
Since:
1.0

consumeProcessOutput

public void consumeProcessOutput(Appendable output, Appendable 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 Appendable. For this, two Threads are started, so this method will return immediately.
Parameters:
output - an Appendable to capture the process stdout.
error - an Appendable to capture the process stderr.
Since:
1.7.5

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.
Since:
1.5.2

consumeProcessOutputStream

public Thread consumeProcessOutputStream(StringBuffer output)
 
Parameters:

consumeProcessOutputStream

public Thread consumeProcessOutputStream(Writer output)
 
Parameters:

consumeProcessOutputStream

public Thread consumeProcessOutputStream(OutputStream output)
 
Parameters:

consumeProcessOutputStream

public Thread consumeProcessOutputStream(Appendable 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 Appendable. A new Thread is started, so this method will return immediately.
Parameters:
output - an Appendable to capture the process stdout.
Returns:
the Thread
Since:
1.7.5

consumeProcessOutputStream

public Thread 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.
Returns:
the Thread
Since:
1.5.2

getErr

public InputStream getErr()
 

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
Since:
1.0

getIn

public InputStream getIn()
 

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
Since:
1.0

getOut

public OutputStream getOut()
 

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
Since:
1.0

getText

public String getText()
 

getText

public String getText()
 
Read the text of the output stream of the Process.
Returns:
the text of the output
Since:
1.0

leftShift

public Writer leftShift(Object value)
 
Parameters:

leftShift

public OutputStream leftShift(byte[] value)
 
Parameters:

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
Since:
1.0

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
Since:
1.0

or

public Process or(Process right)
 
Parameters:

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
Since:
1.5.1

pipeTo

public Process pipeTo(Process right)
 
Parameters:

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
Since:
1.5.2

waitForOrKill

public void waitForOrKill(long numberOfMillis)
 
Parameters:

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.
Since:
1.0

waitForProcessOutput

public void waitForProcessOutput()
 

waitForProcessOutput

public void waitForProcessOutput(StringBuffer output, StringBuffer error)
 
Parameters:

waitForProcessOutput

public void waitForProcessOutput(OutputStream output, OutputStream error)
 
Parameters:

waitForProcessOutput

public void waitForProcessOutput()
 
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 stream data is thrown away but blocking due to a full output buffer is avoided. Use this method if you don't care about the standard or error output and just want the process to run silently - use carefully however, because since the stream data is thrown away, it might be difficult to track down when something goes wrong. For this, two Threads are started, but join()ed, so we wait. As implied by the waitFor... name, we also wait until we finish as well.
Since:
1.6.5

waitForProcessOutput

public void waitForProcessOutput(Appendable output, Appendable 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 Appendable. For this, two Threads are started, but join()ed, so we wait. As implied by the waitFor... name, we also wait until we finish as well.
Parameters:
output - an Appendable to capture the process stdout.
error - an Appendable to capture the process stderr.
Since:
1.7.5

waitForProcessOutput

public void waitForProcessOutput(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, but join()ed, so we wait. As implied by the waitFor... name, we also wait until we finish as well.
Parameters:
output - an OutputStream to capture the process stdout.
error - an OutputStream to capture the process stderr.
Since:
1.6.5

withOutputStream

public void withOutputStream(Closure closure)
 
Parameters:

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.
Since:
1.5.2

withWriter

public void withWriter(Closure closure)
 
Parameters:

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.
Since:
1.5.2

Groovy JDK