org.acm.seguin.io
Class FileCopy

java.lang.Object
  extended by org.acm.seguin.io.FileCopy
All Implemented Interfaces:
java.lang.Runnable

public class FileCopy
extends java.lang.Object
implements java.lang.Runnable

Responsible for copying a file from one location to another. This object is implemented as a thread so that if the user of this object does not care when the copy is complete, they can set the parameters and then launch the thread.

To perform other operations on the streams while copying the thread, simply overload the getInputStream or getOutputStream operations.

Author:
Chris Seguin, Mike Atkinson

Constructor Summary
FileCopy(java.io.File src, java.io.File dst)
          Constructor for the FileCopy object
FileCopy(java.io.File src, java.io.File dst, boolean isNoisy)
          Create a file copy thread
 
Method Summary
protected  java.io.InputStream getInputStream()
          Gets the InputStream attribute of the FileCopy object
protected  java.io.OutputStream getOutputStream()
          Gets the OutputStream attribute of the FileCopy object
static void main(java.lang.String[] args)
          Tester
 void run()
          Copy the thread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileCopy

public FileCopy(java.io.File src,
                java.io.File dst)
Constructor for the FileCopy object

Parameters:
src - the source
dst - the destination

FileCopy

public FileCopy(java.io.File src,
                java.io.File dst,
                boolean isNoisy)
Create a file copy thread

Parameters:
src - the source
dst - the destination
isNoisy - is this thread supposed to report on it's progress
Method Detail

run

public void run()
Copy the thread

Specified by:
run in interface java.lang.Runnable

getInputStream

protected java.io.InputStream getInputStream()
                                      throws java.io.IOException
Gets the InputStream attribute of the FileCopy object

Returns:
The InputStream value
Throws:
FileNotFoundException - Unable to open the file
java.io.IOException

getOutputStream

protected java.io.OutputStream getOutputStream()
                                        throws java.io.IOException
Gets the OutputStream attribute of the FileCopy object

Returns:
The OutputStream value
Throws:
FileNotFoundException - Unable to open the file
java.io.IOException

main

public static void main(java.lang.String[] args)
Tester

Parameters:
args - The command line arguments