|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opensolaris.opengrok.util.Executor
public class Executor
Wrapper to Java Process API
Nested Class Summary | |
---|---|
static interface |
Executor.StreamHandler
You should use the StreamHandler interface if you would like to process the output from a process while it is running |
Constructor Summary | |
---|---|
Executor(java.util.List<java.lang.String> cmdList)
Create a new instance of the Executor. |
|
Executor(java.util.List<java.lang.String> cmdList,
java.io.File workingDirectory)
Create a new instance of the Executor |
|
Executor(java.lang.String[] cmd)
Create a new instance of the Executor. |
Method Summary | |
---|---|
int |
exec()
Execute the command and collect the output. |
int |
exec(boolean reportExceptions)
Execute the command and collect the output |
int |
exec(boolean reportExceptions,
Executor.StreamHandler handler)
Execute the command and collect the output |
java.io.Reader |
getErrorReader()
Get a reader to read the output the process wrote to the error stream. |
java.io.InputStream |
getErrorStream()
Get an inputstreamto read the output the process wrote to the error stream. |
java.lang.String |
getErrorString()
Get the output from the process written to the error stream as a string. |
java.io.Reader |
getOutputReader()
Get a reader to read the output from the process |
java.io.InputStream |
getOutputStream()
Get an input stream read the output from the process |
java.lang.String |
getOutputString()
Get the output from the process as a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Executor(java.lang.String[] cmd)
cmd
- An array containing the command to executepublic Executor(java.util.List<java.lang.String> cmdList)
cmdList
- A list containing the command to executepublic Executor(java.util.List<java.lang.String> cmdList, java.io.File workingDirectory)
cmdList
- A list containing the command to executeworkingDirectory
- The directory the process should have as the
working directoryMethod Detail |
---|
public int exec()
public int exec(boolean reportExceptions)
reportExceptions
- Should exceptions be added to the log or not
public int exec(boolean reportExceptions, Executor.StreamHandler handler)
reportExceptions
- Should exceptions be added to the log or nothandler
- The handler to handle data from standard output
public java.lang.String getOutputString()
public java.io.Reader getOutputReader()
public java.io.InputStream getOutputStream()
public java.lang.String getErrorString()
public java.io.Reader getErrorReader()
public java.io.InputStream getErrorStream()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |