|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sibvisions.util.Execute
public class Execute
The Execute
class executes external programs.
Constructor Summary | |
---|---|
Execute()
|
Method Summary | |
---|---|
void |
addEnvironmentParameter(java.lang.String pName,
java.lang.String pValue)
Adds an environment parameter. |
void |
addListener(IExecuteListener pListener)
Adds an execution listener. |
void |
addParameter(java.lang.String pParam)
Adds a launch parameter. |
void |
destroy()
Destroyes the current process. |
void |
disableSend()
Disables send feature. |
boolean |
execute(boolean pWait)
Launches the given command in a new process. |
int |
getBufferCharacterCount()
Gets the output buffer character count (default: 4000). |
java.lang.String |
getError()
Gets the data of error stream from last exection. |
java.io.PrintStream |
getErrorForwarder()
Gets the forwarder for error messages. |
java.lang.String |
getOutput()
Gets the data of output stream from last exection. |
java.io.PrintStream |
getOutputForwarder()
Gets the forwarder for standard output. |
java.lang.String |
getProgram()
Gets the program to launch. |
java.io.File |
getWorkingDirectory()
Gets the working directory, if set. |
boolean |
isParamsLogEnabled()
Gets whether parameter logging is enabled. |
boolean |
isRunning()
Gets whether the program is still running. |
boolean |
isUseSystemEnvironmentParameter()
Gets whether the default environment parameters should be used. |
void |
removeListener(IExecuteListener pListener)
Removes an execution listener. |
void |
send(byte[] pData)
Sends the given data to the executed program. |
void |
setBufferCharacterCount(int pCharCount)
Sets the output buffer character count. |
void |
setErrorForwarder(java.io.PrintStream pError)
Sets the forwarder for error messages. |
void |
setOutputForwarder(java.io.PrintStream pOutput)
Sets the forwarder for standard output. |
void |
setParamsLogEnabled(boolean pLog)
Sets that parameter logging should be en- or disabled. |
void |
setProgram(java.lang.String pProgram)
Sets the program to launch. |
void |
setUseSystemEnvironmentParameter(boolean pUseSystemEnv)
Sets whether the default environment parameters should be used. |
void |
setWorkingDirectory(java.io.File pWorkDir)
Sets the working directory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Execute()
Method Detail |
---|
public void setProgram(java.lang.String pProgram)
pProgram
- program pathpublic java.lang.String getProgram()
public void addParameter(java.lang.String pParam)
pParam
- parameterpublic void addEnvironmentParameter(java.lang.String pName, java.lang.String pValue)
pName
- the parameter namepValue
- the valuepublic void setUseSystemEnvironmentParameter(boolean pUseSystemEnv)
pUseSystemEnv
- true
to use default environment parameters, false
to
use custom parameters (if set)public boolean isUseSystemEnvironmentParameter()
true
if default environment parameters will be merged with custom parameters (if set),
false
if only custom parameters will be used (if set).public boolean execute(boolean pWait) throws java.lang.Exception
pWait
- true
to wait until process is finished, false
to continue
true
if the exit code is 0
.
If waiting is disabled, returns true
if the process was started.
java.lang.Exception
- if it's not possible to launch the given commandpublic void destroy()
public java.lang.String getError()
execute(boolean)
method was not called, otherwise the data of
the error streampublic java.lang.String getOutput()
execute(boolean)
method was not called, otherwise the data of
the o streampublic void setWorkingDirectory(java.io.File pWorkDir)
pWorkDir
- the directorypublic java.io.File getWorkingDirectory()
null
if no directory is setpublic void setOutputForwarder(java.io.PrintStream pOutput)
pOutput
- the streampublic java.io.PrintStream getOutputForwarder()
null
if no stream is setpublic void setErrorForwarder(java.io.PrintStream pError)
pError
- the streampublic java.io.PrintStream getErrorForwarder()
null
if no stream is setpublic void addListener(IExecuteListener pListener)
pListener
- the listenerpublic void removeListener(IExecuteListener pListener)
pListener
- the listenerpublic void send(byte[] pData) throws java.io.IOException
pData
- the data
java.io.IOException
- if program is not executed or a transmission error occurspublic boolean isRunning()
true
if the program is executed and still running, false
otherwisepublic void setParamsLogEnabled(boolean pLog)
pLog
- true
to turn off logging, false
to use loggingpublic boolean isParamsLogEnabled()
true
if parameter logging is enabled, false
if parameter logging is disabledpublic void setBufferCharacterCount(int pCharCount)
pCharCount
- the number of characters or -1
for unlimited charactersgetBufferCharacterCount()
public int getBufferCharacterCount()
-1
for unlimited characterspublic void disableSend()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |