Package net.sf.basedb.util
Class FileCopyRunnable
java.lang.Object
net.sf.basedb.util.FileCopyRunnable
- All Implemented Interfaces:
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.
- Since:
- 2.15
- Author:
- nicklas
- Last modified
- $Date $
-
Field Summary
Modifier and TypeFieldDescriptionprivate Throwable
private final InputStream
private final OutputStream
-
Constructor Summary
ConstructorDescriptionFileCopyRunnable
(InputStream in, OutputStream out) Create a new file copy object. -
Method Summary
-
Field Details
-
in
-
out
-
error
-
-
Constructor Details
-
FileCopyRunnable
Create a new file copy object. The stream are automatically closed in case of an error- Parameters:
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)
-
-
Method Details
-
run
public void run() -
hasError
public 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:
-
getError
Get the exception that was thrown when executing the file copy operation. This method should only be called after the thread has ended.- Returns:
- An error or null if the operation was sucessful
- See Also:
-