net.sf.jmatchparser.util
Class StreamForwarder
java.lang.Object
java.lang.Thread
net.sf.jmatchparser.util.StreamForwarder
- All Implemented Interfaces:
- Runnable
public class StreamForwarder
- extends Thread
Utility class for forwarding data from an InputStream
to an
OutputStream
or from a Reader
to a Writer
.
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, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
StreamForwarder
public StreamForwarder()
forward
public static void forward(InputStream in,
OutputStream out)
throws IOException
- Forward all content of an
InputStream
to an OutputStream
.
Both streams are closed afterwards.
- Parameters:
in
- the input streamout
- the output stream
- Throws:
IOException
- if one of the streams throws an IOException
forward
public static void forward(Reader in,
Writer out)
throws IOException
- Forward all content of a
Reader
to a Writer
. Both are
closed afterwards.
- Parameters:
in
- the readerout
- the writer
- Throws:
IOException
- if either the reader or the writer throws an
IOException
Copyright © 2011. All Rights Reserved.