Purple Code

com.purpletech.util
Class SmartProcess

java.lang.Object
  |
  +--com.purpletech.util.SmartProcess

public class SmartProcess
extends java.lang.Object

This Object manages a process. You can execute the process and get the output without any fuss (like exceptions).

Version:
1.0
Author:
Ralf Engels

Constructor Summary
SmartProcess(java.lang.String command)
           
 
Method Summary
 void close()
          Closes all streams and kills the process if there is one.
 void destroy()
          Kills the process but leaves the output streams open.
 int execute()
          Wait for process to be executed and returns the result.
 java.lang.String getError()
           
 java.lang.String getErrorOutput()
          Get the error output of the process.
 java.lang.String getNormalOutput()
          Get the output of the process.
protected  java.lang.String getOutput(java.io.Reader reader)
           
 void print(java.lang.String input)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmartProcess

public SmartProcess(java.lang.String command)
Method Detail

getError

public java.lang.String getError()

destroy

public void destroy()
Kills the process but leaves the output streams open. You can get the last output via getNormalOutput and getErrorOutput.

See Also:
getNormalOutput, getErrorOutput

execute

public int execute()
Wait for process to be executed and returns the result.

Returns:
The result of the process or -1 if the process could not be started or an other error occured.

close

public void close()
Closes all streams and kills the process if there is one.


print

public void print(java.lang.String input)

getNormalOutput

public java.lang.String getNormalOutput()
Get the output of the process. Returns the output of the process. The same output is never returned twice. You should better call execute in advance.


getErrorOutput

public java.lang.String getErrorOutput()
Get the error output of the process. Returns the error output of the process. The same output is never returned twice. You should better call execute in advance.


getOutput

protected java.lang.String getOutput(java.io.Reader reader)

Documentation generated March 5 2003