org.vizzini.util
Class StreamGobbler
java.lang.Object
java.lang.Thread
org.vizzini.util.StreamGobbler
- All Implemented Interfaces:
- Runnable
class StreamGobbler
- extends Thread
Provides a stream gobbler. Typical usage is to drain the error and output
streams when using Runtime.exec().
Process process = Runtime.getRuntime().exec(command);
StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), "ERROR", false);
StreamGobbler outputGobbler = new StreamGobbler(process.getInputStream(), "OUTPUT", false);
errorGobbler.start();
outputGobbler.start();
try
{
process.waitFor();
}
catch (InterruptedException e)
{
LOGGER.log(Level.SEVERE, e.getMessage(), e);
}
- Since:
- v0.3
- Version:
- v0.3
- Author:
- Jeffrey M. Thompson
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, 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 |
StreamGobbler
StreamGobbler(InputStream inputStream,
String type,
boolean isVerbose)
- Construct this object with the given parameters.
- Parameters:
inputStream
- Input stream.type
- Stream type.isVerbose
- Flag indicating whether to produce verbose output.- Since:
- v0.3
isOutputProduced
public boolean isOutputProduced()
- Returns:
- Return isOutputProduced.
- Since:
- v0.3
run
public void run()
- Run this thread.
- Specified by:
run
in interface Runnable
- Overrides:
run
in class Thread
- Since:
- v0.3
Copyright © 2007 Vizzini.org. All Rights Reserved.
|
2007.12.25.03.00.02 |