kawigi.util
Class ProcessContainer

java.lang.Object
  extended by kawigi.util.ProcessContainer

public class ProcessContainer
extends java.lang.Object

I couldn't do local compiling and testing without this. This contains and manages a process and forwards its output using ProcessOutput objects.


Constructor Summary
ProcessContainer(java.lang.Process p, ConsoleDisplay output, ConsoleDisplay error)
          Creates a new ProcessContainer for p that forwards its standard output/error streams into output.
ProcessContainer(java.lang.Process p, ConsoleDisplay output, ConsoleDisplay error, boolean doTimeout)
          Creates a new ProcessContainer for p that forwards its standard output/error streams into output.
 
Method Summary
 int endVal()
          Returns the exit value of the process, waiting for it to finish if it hasn't yet.
 ConsoleDisplay getErrDisplay()
          Returns the display for stderr.
 ConsoleDisplay getStdDisplay()
          Returns the display for stdout.
 boolean isDone()
          Returns true if this process has finished.
 void kill()
          Forceably kills the process.
 void start()
          Starts the threads that listen to the output and error streams of the process.
 void waitFor()
          Finishes and stores the exit value for the process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProcessContainer

public ProcessContainer(java.lang.Process p,
                        ConsoleDisplay output,
                        ConsoleDisplay error)
Creates a new ProcessContainer for p that forwards its standard output/error streams into output. Note that it will clear output if it isn't already clear. This process will be forcibly killed according to the current user settings.


ProcessContainer

public ProcessContainer(java.lang.Process p,
                        ConsoleDisplay output,
                        ConsoleDisplay error,
                        boolean doTimeout)
Creates a new ProcessContainer for p that forwards its standard output/error streams into output. Note that it will clear output if it isn't already clear. If doTimeout is true, the process will be killed according to the current user settings for the time limit.

Method Detail

start

public void start()
Starts the threads that listen to the output and error streams of the process.


waitFor

public void waitFor()
Finishes and stores the exit value for the process.


isDone

public boolean isDone()
Returns true if this process has finished.


kill

public void kill()
Forceably kills the process. You'll be glad sometimes that this option exists.


endVal

public int endVal()
Returns the exit value of the process, waiting for it to finish if it hasn't yet.


getStdDisplay

public ConsoleDisplay getStdDisplay()
Returns the display for stdout.


getErrDisplay

public ConsoleDisplay getErrDisplay()
Returns the display for stderr.