- All Implemented Interfaces:
public class FileCopyRunnable extends Object implements Runnable
Runnable implementation that copies data from an input stream to an output stream when executed. This is useful when executing external processes since reading and writing to their stdin and stdout is best done with separate thread.
- Last modified
- $Date $
Fields Modifier and Type Field Description
Constructors Constructor Description
FileCopyRunnable(InputStream in, OutputStream out)Create a new file copy object.
inprivate final InputStream in
outprivate final OutputStream out
errorprivate Throwable error
FileCopyRunnablepublic FileCopyRunnable(InputStream in, OutputStream out)Create a new file copy object. The stream are automatically closed in case of an error
in- The input stream to read data from (required)
out- The output stream to write data to (optional; if not given the input stream is read and then discarded)
runpublic void run()
hasErrorpublic boolean hasError()A boolean flag indicating if the copying was sucessful or not. This method should only be called after the thread has ended.
- See Also:
getErrorpublic Throwable getError()Get the exception that was thrown when executing the file copy operation. This method should only be called after the thread has ended.
- An error or null if the operation was sucessful
- See Also: