ca.bc.webarts.tools
Class StreamGobbler

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--ca.bc.webarts.tools.StreamGobbler
All Implemented Interfaces:
java.lang.Runnable

class StreamGobbler
extends java.lang.Thread

A helper thread to accept an input stream and dump it to System.out. It also pre-pends the input stream output lines with a passed in string (such as "ERROR:").

This class is specially suited for the Streams received from the Runtime.exec processes.


Field Summary
 boolean finishedGobbling_
          Flag to signal that we are done with this thread and can die gracefully.
(package private)  java.io.InputStream is_
          The Class holder for the InputStream to dump out.
(package private)  java.lang.String type_
          The class holder for text string to add to the start of each output line.
 
Fields inherited from class java.lang.Thread
contextClassLoader, daemon, eetop, group, inheritableThreadLocals, inheritedAccessControlContext, MAX_PRIORITY, MIN_PRIORITY, name, NORM_PRIORITY, priority, single_step, stillborn, stopThreadPermission, target, threadInitNumber, threadLocals, threadQ
 
Constructor Summary
(package private) StreamGobbler(java.io.InputStream is, java.lang.String type)
          Basic constructor that simply accepts/assigns the required passed parameters.
 
Method Summary
 void run()
          This is where all the reading and writing to System.out happens.
 
Methods inherited from class java.lang.Thread
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, exit, getContextClassLoader, getName, getPriority, getThreadGroup, init, interrupt, interrupt0, interrupted, isAlive, isDaemon, isInterrupted, isInterrupted, join, join, join, nextThreadNum, registerNatives, resume, resume0, setContextClassLoader, setDaemon, setName, setPriority, setPriority0, sleep, sleep, start, stop, stop, stop0, suspend, suspend0, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

is_

java.io.InputStream is_
The Class holder for the InputStream to dump out.

type_

java.lang.String type_
The class holder for text string to add to the start of each output line.

finishedGobbling_

public boolean finishedGobbling_
Flag to signal that we are done with this thread and can die gracefully.
Constructor Detail

StreamGobbler

StreamGobbler(java.io.InputStream is,
              java.lang.String type)
Basic constructor that simply accepts/assigns the required passed parameters.
Parameters:
is - the InputStream to dump
type - the text string to add to the start of each output line.
Method Detail

run

public void run()
This is where all the reading and writing to System.out happens.
Overrides:
run in class java.lang.Thread