net.sf.basedb.util
Class FileCopyRunnable
java.lang.Object
net.sf.basedb.util.FileCopyRunnable
- All Implemented Interfaces:
- Runnable
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.
- Since:
- 2.15
- Author:
- nicklas
- Last modified
- $Date $
Method Summary |
Throwable |
getError()
Get the exception that was thrown when executing the file copy
operation. |
boolean |
hasError()
A boolean flag indicating if the copying was sucessful or not. |
void |
run()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
in
private final InputStream in
out
private final OutputStream out
error
private Throwable error
FileCopyRunnable
public FileCopyRunnable(InputStream in,
OutputStream out)
- 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)
run
public void run()
- Specified by:
run
in interface Runnable
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()
getError
public 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.
- Returns:
- An error or null if the operation was sucessful
- See Also:
hasError()