nl.uva.vlet.exec
Class LocalProcess

java.lang.Object
  extended by nl.uva.vlet.exec.LocalProcess
All Implemented Interfaces:
VProcess

public class LocalProcess
extends java.lang.Object
implements VProcess

Process Information wrapper


Constructor Summary
LocalProcess()
           
LocalProcess(java.lang.Process process)
           
 
Method Summary
 void captureOutput(boolean captureOut, boolean captureErr)
           
 void execute(java.lang.String[] cmds, boolean syncWait)
          Execute command.
 int getExitValue()
          Get exit value.
 java.io.OutputStream getOutputStream()
          Get OutputStream to write to:
 java.lang.String getStderr()
          Returns stderr of terminated process.
 java.lang.String getStdout()
          Returns stdout of terminated process.
 boolean isTerminated()
           
 void setCaptureOutput(boolean captureStdout, boolean captureStderr)
           
 void terminate()
          Terminate process immediatly.
 void waitFor()
          Wait for the process to terminate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalProcess

public LocalProcess(java.lang.Process process)

LocalProcess

public LocalProcess()
Method Detail

captureOutput

public void captureOutput(boolean captureOut,
                          boolean captureErr)

waitFor

public void waitFor()
             throws VlException
Description copied from interface: VProcess
Wait for the process to terminate.

Specified by:
waitFor in interface VProcess
Throws:
VlException

setCaptureOutput

public void setCaptureOutput(boolean captureStdout,
                             boolean captureStderr)

execute

public void execute(java.lang.String[] cmds,
                    boolean syncWait)
             throws VlException
Description copied from interface: VProcess
Execute command. cmds contains command line argument, where cmd[0] is the command to start and cmds[1] to cmds[...] are the arguments of the command.

Specified by:
execute in interface VProcess
syncWait - whether the command should wait for the process to end
Throws:
VlException

getStdout

public java.lang.String getStdout()
Returns stdout of terminated process. If this method is called during execution of a process this method will return null.

Specified by:
getStdout in interface VProcess

getStderr

public java.lang.String getStderr()
Returns stderr of terminated process. If this method is called during execution of a process this method will return null.

Specified by:
getStderr in interface VProcess

getExitValue

public int getExitValue()
Description copied from interface: VProcess
Get exit value. Process must have terminated

Specified by:
getExitValue in interface VProcess

terminate

public void terminate()
Description copied from interface: VProcess
Terminate process immediatly. It is recommended to do a waitFor() after this command before issueing a getStderr(), getStdout() or getExitValue() so the process stats are updated correctly.

Specified by:
terminate in interface VProcess

isTerminated

public boolean isTerminated()

getOutputStream

public java.io.OutputStream getOutputStream()
Description copied from interface: VProcess
Get OutputStream to write to:

Specified by:
getOutputStream in interface VProcess