|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cometway.util.KMethod
com.cometway.util.ExecuteCommand
public class ExecuteCommand
This method extends com.cometway.util.KMethod and implements the Runnable interface, which allows this KMethod to be executed by a PooledThread from a ThreadPool or another Thread. This class provides a simple way of executing System commands via the Runtime.exec() and Process classes/methods.
| Field Summary | |
|---|---|
boolean |
changeErrCRtoLF
Set this to true if Carriage Returns are to be change to Line Feeds in the process' error output. |
boolean |
changeErrLFtoCR
Set this to true if Line Feeds are to be change to Carriage Returns in the process' error output. |
boolean |
changeOutCRtoLF
Set this to true if Carriage Returns are to be change to Line Feeds in the process' output. |
boolean |
changeOutLFtoCR
Set this to true if Line Feeds are to be change to Carriage Returns in the process' output. |
java.lang.String |
commandInput
This is the Input sent to the Process OuputStream after execution. |
java.lang.String[] |
environment
Set this to the environment variables |
java.lang.Thread |
execThread
This is set to the Thread that is executing this KMethod upon execution. |
int |
finishedWaitTime
Set this to the number of milliseconds to wait after the process is finished. |
java.lang.StringBuffer |
processErr
Set this to the StringBuffer used to store the process' error output. |
ThreadPool |
processErrThreads
Set this to the ThreadPool which is used to read the process' error output. |
java.lang.StringBuffer |
processOut
Set this to the StringBuffer used to store the process' output. |
ThreadPool |
processOutThreads
Set this to the ThreadPool which is used to read the process' output. |
int |
returnValue
Return value of the command |
boolean |
waitForProcess
Set this to False if the process will not be waited for. |
boolean |
waitForProcessReaders
Set this to True if the run() method is to block until the readers read until an End Of Transmission character. |
java.io.File |
workingDirectory
Set this to the working directory when the command is executed |
| Fields inherited from class com.cometway.util.KMethod |
|---|
args, debugName, method, obj, print_errors, run, verbose |
| Constructor Summary | |
|---|---|
ExecuteCommand(java.lang.String executeString)
|
|
ExecuteCommand(java.lang.String executeString,
java.lang.String commandInput)
|
|
| Method Summary | |
|---|---|
void |
execute()
Calling this will execute this KMethod, which executes what the KMethod wraps. |
boolean |
isRunning()
|
static void |
main(java.lang.String[] args)
|
void |
run()
|
void |
stopProcess()
This method should be called before the PooledThread is released from the ThreadPool. |
| Methods inherited from class com.cometway.util.KMethod |
|---|
error, error, print |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public java.lang.String commandInput
public java.lang.Thread execThread
public ThreadPool processOutThreads
public ThreadPool processErrThreads
public java.lang.StringBuffer processOut
public java.lang.StringBuffer processErr
public boolean waitForProcess
public boolean waitForProcessReaders
public int finishedWaitTime
public boolean changeOutLFtoCR
public boolean changeOutCRtoLF
public boolean changeErrLFtoCR
public boolean changeErrCRtoLF
public int returnValue
public java.io.File workingDirectory
public java.lang.String[] environment
| Constructor Detail |
|---|
public ExecuteCommand(java.lang.String executeString)
public ExecuteCommand(java.lang.String executeString,
java.lang.String commandInput)
| Method Detail |
|---|
public void execute()
KMethod
execute in class KMethodpublic void run()
run in interface java.lang.Runnablepublic boolean isRunning()
public void stopProcess()
public static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||