de.unkrig.commons.file
Class FileUtil

java.lang.Object
  extended by de.unkrig.commons.file.FileUtil

public final class FileUtil
extends java.lang.Object

Utility class for various file operations.


Method Summary
static boolean attemptToDeleteRecursively(java.io.File file)
          Similar to File.delete(), but clears and deletes directory trees recursively.
static void deleteRecursively(java.io.File file)
          Deletes the given regular file, or clears and deletes the given directory recursively.
static void rename(java.io.File oldFile, java.io.File newFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

attemptToDeleteRecursively

public static boolean attemptToDeleteRecursively(java.io.File file)
Similar to File.delete(), but clears and deletes directory trees recursively.

Parameters:
file - The regular file or directory to delete
Returns:
Whether the regular file or the directory and its members could successfully be deleted

deleteRecursively

public static void deleteRecursively(java.io.File file)
                              throws java.io.IOException
Deletes the given regular file, or clears and deletes the given directory recursively.

Throws:
java.io.IOException - The file could not be deleted

rename

public static void rename(java.io.File oldFile,
                          java.io.File newFile)
                   throws java.io.IOException
Throws:
java.io.IOException - Renaming failed
See Also:
File.renameTo(File)