ch.sf.htt
Class ProcessStreamHandler

java.lang.Object
  extended by java.lang.Thread
      extended by ch.sf.htt.ProcessStreamHandler
All Implemented Interfaces:
java.lang.Runnable

public class ProcessStreamHandler
extends java.lang.Thread

Reads any input stream in a separate thread until the stream is finished.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ProcessStreamHandler(java.io.InputStream inputStream, java.lang.String streamType)
          Creates an instance of a process stream handler.
ProcessStreamHandler(java.io.InputStream inputStream, java.lang.String streamType, ITestListener listener)
          Creates an instance of a process stream handler.
 
Method Summary
 java.util.List<java.lang.String> getText()
          Returns the text read from the input stream as a list of strings.
 boolean hasCompleted()
          Returns true if the stream has been read completely.
 void interrupt()
          Interrupts reading of this stream.
 void run()
           
 void setVerbose(boolean value)
          Allows to enable or disable verbose output.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProcessStreamHandler

public ProcessStreamHandler(java.io.InputStream inputStream,
                            java.lang.String streamType,
                            ITestListener listener)
Creates an instance of a process stream handler.

Parameters:
inputStream - The InputStream that must be read.
streamType - The stream type (just a name, like "stdout").

ProcessStreamHandler

public ProcessStreamHandler(java.io.InputStream inputStream,
                            java.lang.String streamType)
Creates an instance of a process stream handler.

Parameters:
inputStream - The InputStream that must be read.
streamType - The stream type (just a name, like "stdout").
Method Detail

interrupt

public void interrupt()
Interrupts reading of this stream.

Overrides:
interrupt in class java.lang.Thread

setVerbose

public void setVerbose(boolean value)
Allows to enable or disable verbose output.

Parameters:
value - If true, debug output is enabled.

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

getText

public java.util.List<java.lang.String> getText()
Returns the text read from the input stream as a list of strings.

Returns:
The InputStream contents.

hasCompleted

public boolean hasCompleted()
Returns true if the stream has been read completely.

Returns:
True if the thread has finished.