net.sf.jmatchparser.util
Class StreamForwarder

java.lang.Object
  extended by java.lang.Thread
      extended by 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.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
StreamForwarder()
           
 
Method Summary
static void forward(InputStream in, OutputStream out)
          Forward all content of an InputStream to an OutputStream.
static void forward(Reader in, Writer out)
          Forward all content of 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StreamForwarder

public StreamForwarder()
Method Detail

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 stream
out - 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 reader
out - the writer
Throws:
IOException - if either the reader or the writer throws an IOException


Copyright © 2011. All Rights Reserved.