de.hunsicker.io
Class Copy

java.lang.Object
  |
  +--de.hunsicker.io.Copy

public class Copy
extends java.lang.Object

Helper routines for copying files or directories.

Version:
$Revision: 1.4.2.1 $
Author:
Marco Hunsicker

Method Summary
static boolean directory(java.io.File source, java.io.File destination)
          Copies the given directory to the new location.
static boolean file(java.io.File source, java.io.File destination)
          Copies the given file to dest.
static boolean file(java.io.File source, java.io.File destination, boolean overwrite)
          Copies the given file to dest.
static boolean file(java.lang.String source, java.lang.String destination)
          Copies the given file to dest.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

directory

public static boolean directory(java.io.File source,
                                java.io.File destination)
                         throws java.io.IOException
Copies the given directory to the new location.

Parameters:
source - the directory to copy.
destination - the destination directory.
Returns:
true if the operation ended upon success.
Throws:
java.io.IOException - if an I/O error occured.
java.lang.NullPointerException - if source == null
java.lang.IllegalArgumentException - if source does not exist or does not denote a directory.

file

public static boolean file(java.lang.String source,
                           java.lang.String destination)
                    throws java.io.IOException
Copies the given file to dest. Calls file(File,File,boolean).

Parameters:
source - source file.
destination - destination file.
Returns:
Returns true if the file was sucessfully copied.
Throws:
java.io.IOException - if an I/O error occured.

file

public static boolean file(java.io.File source,
                           java.io.File destination)
                    throws java.io.IOException
Copies the given file to dest. Calls file(File,File,boolean).

Parameters:
source - source file.
destination - destination file.
Returns:
Returns true if the file was sucessfully copied
Throws:
java.io.IOException - if an I/O error occured.

file

public static boolean file(java.io.File source,
                           java.io.File destination,
                           boolean overwrite)
                    throws java.io.IOException
Copies the given file to dest.

Parameters:
source - source file.
destination - destination file.
overwrite - if true the destination file will be always overwritten if it already exists; if false it will only be overwritten if the source file is newer than the destination file.
Returns:
Returns true if the file was sucessfully copied
Throws:
java.io.IOException - if an I/O error occured.
java.lang.NullPointerException - if source == null
java.lang.IllegalArgumentException - if source does not exist or does not denote a file.


Copyright © 1997-2005 Jalopy. All Rights Reserved.