se.unlogic.standardutils.exec
Class StreamPrinter
java.lang.Object
java.lang.Thread
se.unlogic.standardutils.exec.StreamPrinter
- All Implemented Interfaces:
- Runnable, StreamHandler
public class StreamPrinter
- extends Thread
- implements StreamHandler
A simple buffered StreamHandler implementation that prints the input from the InputStream to the given OutputStream. If no OutputStream is given it defaults to System.out.
This implementation inputStream based on the PrintWriter, InputStreamReader and BufferedReader classes.
- Author:
- Robert "Unlogic" Olofsson (unlogic@unlogic.se)
| 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, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
StreamPrinter
public StreamPrinter(String prefix,
OutputStream os)
StreamPrinter
public StreamPrinter(OutputStream os)
StreamPrinter
public StreamPrinter()
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated in interface StreamHandler
terminate
public void terminate()
- Specified by:
terminate in interface StreamHandler
run
public void run()
- Specified by:
run in interface Runnable- Overrides:
run in class Thread
handleStream
public void handleStream(InputStream is)
- Specified by:
handleStream in interface StreamHandler
getPrefix
public String getPrefix()
getOutputStream
public OutputStream getOutputStream()
isFinished
public boolean isFinished()
- Specified by:
isFinished in interface StreamHandler
awaitFinish
public void awaitFinish()
- Specified by:
awaitFinish in interface StreamHandler
Copyright © 2011. All Rights Reserved.