public class StreamGobbler extends Thread
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
(package private) boolean |
aborted_
the thread aborted flag.
|
(package private) boolean |
capture_
a control flag that turns on/off the capturing of the input stream
|
(package private) StringBuffer |
captureBuffer_
The buffer used to store the input stream data IFF the capture has been
turned on with the capture_ flag.
|
boolean |
finishedGobbling_
Flag so we can signal the control/signal the threads end.
|
(package private) String |
input_
the input from in stream
|
(package private) boolean |
inputGobbler_
signals if we are gobbling input instead of the default outputstreams.
|
(package private) InputStream |
is_
The class InputStream that gets echoed to the designated output stream
(default=System.out).
|
(package private) String |
lineSep_
the lin sep chars
|
(package private) OutputStream |
os_
The location of any output.
|
(package private) PrintStream |
ps_
The location of any output.
|
(package private) String |
type_
The string to get prepended to the output from the InputStream.
|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
StreamGobbler()
A Simple Constructor for the StreamGobbler object WITHOUT assigning a
stream to gobble.
|
StreamGobbler(InputStream inputstream,
PrintStream ps)
Constructor for the StreamGobbler object that requires all parameters to
be spec'd.
|
StreamGobbler(InputStream inputstream,
String string)
A Simple Constructor for the StreamGobbler object that ends up using
System.out as the Output PrintStream.
|
StreamGobbler(InputStream inputstream,
String string,
PrintStream os)
Constructor for the StreamGobbler object that requires all parameters to
be spec'd.
|
Modifier and Type | Method and Description |
---|---|
void |
abort() |
boolean |
getCapture()
Get Method for class field 'capture_'.
|
String |
getCapturedOutput()
Gets the inputStreams captured data.
|
InputStream |
getInputStream()
Get Method for class field 'is_'.
|
PrintStream |
getOs_()
Get Method for class field 'ps_'.
|
String |
getPrependString()
Get Method for class field 'type_' which is the string to prepend to the output.
|
void |
run()
Main processing method for the StreamGobbler object
|
void |
setCapture(boolean capture)
Set Method for class field 'capture_'.
|
void |
setInputStream(InputStream is)
Set Method for class field 'is_'.
|
void |
setOs_(PrintStream ps_)
Set Method for class field 'ps_'.
|
void |
setPrependString(String prepend)
Set Method for class field 'type_' which sets the string to prepend to the output.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public boolean finishedGobbling_
InputStream is_
PrintStream ps_
OutputStream os_
boolean inputGobbler_
boolean aborted_
boolean capture_
StringBuffer captureBuffer_
public StreamGobbler()
public StreamGobbler(InputStream inputstream, String string)
inputstream
- The stream to watch for input.string
- The string to get prepended to the output from the
InputStream before it gets pumped into the output
PrintStream.public StreamGobbler(InputStream inputstream, String string, PrintStream os)
inputstream
- The stream to watch for input.string
- The string to get prepended to the output from the
InputStream before it gets pumped into the output
PrintStream.os
- An output PrintStream to send the data to.public StreamGobbler(InputStream inputstream, PrintStream ps)
inputstream
- The stream to watch for input.ps
- An output PrintStream to send the data to, If
this is null it simply captures the output.public void run()
public void abort()
public void setPrependString(String prepend)
is
- the value to set this class field to.public String getPrependString()
public void setInputStream(InputStream is)
is
- is the value to set this class field to.public InputStream getInputStream()
public void setOs_(PrintStream ps_)
ps_
- is the value to set this class field to.public PrintStream getOs_()
public String getCapturedOutput()
public void setCapture(boolean capture)
capture_
- is the value to set this class field to.public boolean getCapture()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses