au.gov.tas.dpiwe.mr.tool
Class MultiCopy
java.lang.Object
au.gov.tas.dpiwe.mr.tool.MultiCopy
- Direct Known Subclasses:
- MultiCount, RejarTool
public class MultiCopy
- extends Object
This tool copies the files in multiple directories meeting the filename
specification.
- Since:
- Mr Architecture 3.0
- Version:
- 1.0.0.5
- Author:
- Kade Hansson
- See Also:
MultiEnumDir, MultiNewer
|
Method Summary |
static long |
copy(InputStream input,
OutputStream output)
Produce a copy of a stream. |
static boolean |
copy(String filename,
String copyDir)
Produce a copy of a file in the specified directory. |
static void |
main(String[] argv)
Initiates the MultiCopy tool. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
totalCount
protected static ThreadLocal totalCount
MultiCopy
public MultiCopy()
main
public static void main(String[] argv)
throws Exception
- Initiates the MultiCopy tool.
- The switch "-single" introduces the following parameters as single
source filenames. If you don't specify a switch, "-single" is assumed.
- The switch "-multi" introduces the following parameters as directory
names, which are recursively searched for all files meeting the "-spec".
- The switch "-spec" introduces the following parameter as a
wildcarded filename specification. Only one spec is supported by this
version of the tool.
- The switch "-destination" introduces the following parameter as a
destination for copied files. Only one destination is supported by this
version of the tool.
- Parameters:
argv - arguments are filenames, directory names or switches (one of
"-destination", "-spec", -single" or "-multi").
- Throws:
IOException - if the input files could not be read or the output
files could not be written.
SecurityException - if the configured security policy is too
restrictive.
Exception - if something else goes wrong.
copy
public static boolean copy(String filename,
String copyDir)
throws IOException,
SecurityException
- Produce a copy of a file in the specified directory.
- Parameters:
filename - the name of the file to be copied.copyDir - the directory to contain the copied file.
- Returns:
- true if the file was successfully copied, false if the file
copy was abandoned.
- Throws:
IOException - if the input files could not be read or the output
file could not be written.
SecurityException - if the configured security policy is too
restrictive.
copy
public static long copy(InputStream input,
OutputStream output)
throws IOException
- Produce a copy of a stream.
- Parameters:
input - the InputStream from which the original file should be read.output - the OutputStream to which the copied file should be written.
- Throws:
IOException - if the input file could not be read or the output
file could not be written.