net.sf.zig_project.gpl.common.io
Class Filer
java.lang.Object
net.sf.zig_project.gpl.common.io.Filer
- public abstract class Filer
- extends Object
Provides a set of common routines for dealing with files managed by the
local file system.
- Version:
- November 22, 2004
- Author:
- Frank Ziglar
Constructor Summary |
Filer()
|
Method Summary |
static void |
copy(File source,
File target)
Duplicates a file. |
static void |
copy(File source,
File target,
byte[] buffer)
Duplicates a file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Filer
public Filer()
copy
public static void copy(File source,
File target)
throws IOException
- Duplicates a file.
- Throws:
IOException
- See Also:
copy(File, File, byte[])
copy
public static void copy(File source,
File target,
byte[] buffer)
throws IOException
- Duplicates a file.
- If source does not exist, a
FileNotFoundException
is thrown
- If target already exists, then
- If target is a directory, then the new file will
reside within the target, retaining it's
origional name.
- If target still exists (after possibly applying the
previous rule), then an exception will be raised
to avoid overwriting the existing target file
- If source is a directory, then
- Target is created as a new directory
- Each file from the source directory is copied into the
target directory, preserving their names within their
parent directory.
- The contents are not necessarily copied to the target in
order. It is assumed the filesystem will organized the
files by name, or that the order of the files is not
relevant.
- Otherwise, source is assumed to be a data file, and a new file is
created with the target name, containing a binary duplicate
of the source.
- Throws:
IOException