public class StreamPlugThread extends Thread
StreamPlugThread is a utility class that "plugs" two streams,
one input stream and one output stream, together by creating a thread that
repeatedly reads any data available from the input stream and writes it to
the output stream.Thread.State, Thread.UncaughtExceptionHandler| Modifier and Type | Field and Description |
|---|---|
private InputStream |
in |
private OutputStream |
out |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
StreamPlugThread(InputStream in,
OutputStream out) |
| Modifier and Type | Method and Description |
|---|---|
static void |
error(String err) |
static void |
main(String[] args) |
static void |
plugTogether(InputStream in,
OutputStream out) |
static void |
plugTogether(OutputStream out,
InputStream in) |
void |
run() |
static Process |
userProg(String cmd) |
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, yieldprivate InputStream in
private OutputStream out
public StreamPlugThread(InputStream in, OutputStream out)
public static void plugTogether(InputStream in, OutputStream out)
public static void plugTogether(OutputStream out, InputStream in)
public static Process userProg(String cmd) throws IOException
IOExceptionpublic static void main(String[] args)
public static void error(String err)
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.