Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## umontreal.iro.lecuyer.util
Class FileUtil

    java.lang.Object
      umontreal.iro.lecuyer.util.FileUtil

    public class FileUtil

extends Object

Method Summary
`static void` | `copyFile(File srcFile, File destFile)` Copies the file `srcFile` into the destination file `destFile`.
`static boolean` | `delete(File f)` Deletes the file or empty directory `f`, and returns the success indicator of the operation.
`static void` | `moveFile(File srcFile, File destFile)` Moves the file `srcFile` to `destFile`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### delete

    public static boolean delete(File f)

  Deletes the file or empty directory `f`, and returns the success indicator of the operation. This method is similar to `File.delete()`, except that if the first call to `delete` fails, it attemps to call the method a second time after 10ms. This is a heuristic attempt to fix a possible race condition when deleting a file under Windows XP inspired from Ant's source code.

  Parameters:
    `f` - the file or empty being deleted.
  Returns:
    the success indicator of the operation.

### copyFile

    public static void copyFile(File srcFile,
                                File destFile)
                         throws IOException

  Copies the file `srcFile` into the destination file `destFile`. If `destFile` represents a directory, a new file having the same name and contents as `srcFile` is created in the referred directory. If `destFile` represents an existing file, it is overwritten with the contents of `srcFile`. Otherwise, a new file is created.

  Parameters:
    `srcFile` - the source file.
    `destFile` - the destination file.
  Throws:
    `IOException` - if a problem occurs during the copy.
    `NullPointerException` - if any argument is `null`.

### moveFile

    public static void moveFile(File srcFile,
                                File destFile)
                         throws IOException

  Moves the file `srcFile` to `destFile`. This method is similar to `File)`, except it deletes the source file after the copy succeeds. Moreover, before making a full copy of the file, the method tries to use `File.renameTo(File)` which might rename the file without copying it on some platforms. The copy happens only if the call to `File.renameTo(File)` fails.

  Parameters:
    `srcFile` - the source file.
    `destFile` - the destination file.
  Throws:
    `IOException` - if a problem occurs during file moving.

Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

To submit a bug or ask questions, send an e-mail to Richard Simard.