Package cx.ath.matthew.io
Class InOutCopier
- java.lang.Object
-
- java.lang.Thread
-
- cx.ath.matthew.io.InOutCopier
-
- All Implemented Interfaces:
java.lang.Runnable
public class InOutCopier extends java.lang.ThreadCopies from an input stream to an output stream using a Thread. example:InputStream a = getInputStream(); OutputStream b = getOutputStream(); InOutCopier copier = new InOutCopier(a, b); copier.start(); <do stuff that writes to the inputstream>
-
-
Constructor Summary
Constructors Constructor Description InOutCopier(java.io.InputStream is, java.io.OutputStream os)Create a copier from an inputstream to an outputstream
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Force close the stream without waiting for EOF on the sourcevoidflush()Flush the outputstreamvoidrun()Copies from the inputstream to the outputstream until EOF on the inputstream or explicitly closedvoidstart()Start the thread and wait to make sure its really started-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, suspend, toString, yield
-
-
-
-
Method Detail
-
close
public void close()
Force close the stream without waiting for EOF on the source
-
flush
public void flush() throws java.io.IOExceptionFlush the outputstream- Throws:
java.io.IOException
-
start
public void start()
Start the thread and wait to make sure its really started- Overrides:
startin classjava.lang.Thread
-
run
public void run()
Copies from the inputstream to the outputstream until EOF on the inputstream or explicitly closed- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classjava.lang.Thread- See Also:
close()
-
-