|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.opennms.netmgt.utils.StreamGobbler
Captures the output of an InputStream.
With acknowledgements to Michael C. Daconta, author of "Java Pitfalls, Time Saving Solutions, and Workarounds to Improve Programs." and his article in JavaWorld "When Runtime.exec() Won't". See the ExecRunner class for a reference implementation.
Field Summary | |
private static java.lang.String |
CLASS_NAME
The name of this class for logging * |
private java.io.InputStream |
in
The input stream we're gobbling * |
private java.io.PrintWriter |
pwOut
The printwriter we'll send the gobbled characters to if asked* |
private boolean |
quit
Our flag to allow us to safely terminate the monitoring thread * |
private static java.lang.String |
VERSION
The version of this class (filled in by CVS) * |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
StreamGobbler()
Basic constructor for StreamGobbler. |
|
StreamGobbler(java.io.InputStream in)
A simpler constructor for StreamGobbler - defaults to stdout. |
|
StreamGobbler(java.io.InputStream in,
java.io.OutputStream out)
A more explicit constructor for StreamGobbler where you can tell it exactly where to relay the output to. |
|
StreamGobbler(java.io.InputStream in,
java.io.PrintWriter pwOut)
A more explicit constructor for StreamGobbler where you can tell it exactly where to relay the output to. |
Method Summary | |
java.lang.Object |
clone()
We override the clone method here to prevent cloning of
our class. |
void |
quit()
Tells the StreamGobbler to quit it's operation. |
private void |
readObject(java.io.ObjectInputStream in)
We override the readObject method here to prevent
deserialization of our class for security reasons. |
void |
run()
Gobbles up all the stuff coming from the InputStream and sends it to the OutputStream specified during object construction. |
private void |
writeObject(java.io.ObjectOutputStream out)
We override the writeObject method here to prevent
serialization of our class for security reasons. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private java.io.InputStream in
private java.io.PrintWriter pwOut
private boolean quit
private static final java.lang.String CLASS_NAME
private static final java.lang.String VERSION
Constructor Detail |
public StreamGobbler()
public StreamGobbler(java.io.InputStream in)
in
- InputStreampublic StreamGobbler(java.io.InputStream in, java.io.OutputStream out)
in
- InputStreamout
- OutputStreampublic StreamGobbler(java.io.InputStream in, java.io.PrintWriter pwOut)
in
- InputStreampwOut
- PrintWriterMethod Detail |
public final java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
method here to prevent cloning of
our class.
java.lang.CloneNotSupportedException
- To indicate cloning is not allowedpublic void quit()
private final void readObject(java.io.ObjectInputStream in) throws java.io.IOException
readObject
method here to prevent
deserialization of our class for security reasons.
in
- java.io.ObjectInputStream
java.io.IOException
- thrown if a problem occurspublic void run()
private final void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
writeObject
method here to prevent
serialization of our class for security reasons.
out
- java.io.ObjectOutputStream
java.io.IOException
- thrown if a problem occurs
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |