org.apache.tomcat.util.http.fileupload
Class FileUtils

java.lang.Object
  extended by org.apache.tomcat.util.http.fileupload.FileUtils

public class FileUtils
extends java.lang.Object

General file manipulation utilities.

Facilities are provided in the following areas:

Origin of code: Excalibur, Alexandria, Commons-Utils

Version:
$Id: FileUtils.java 881493 2009-11-17 20:30:39Z markt $
Author:
Kevin A. Burton, Scott Sanders, Daniel Rall, Christoph.Reck, Peter Donald, Jeff Turner, Matthew Hawthorne, Jeremias Maerki, Stephen Colebourne, Ian Springer, Chris Eldredge, Jim Harrington, Niall Pemberton, Sandy McArthur

Constructor Summary
FileUtils()
          Instances should NOT be constructed in standard programming.
 
Method Summary
static void cleanDirectory(java.io.File directory)
          Cleans a directory without deleting it.
static void deleteDirectory(java.io.File directory)
          Deletes a directory recursively.
static void forceDelete(java.io.File file)
          Deletes a file.
static void forceDeleteOnExit(java.io.File file)
          Schedules a file to be deleted when JVM exits.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils()
Instances should NOT be constructed in standard programming.

Method Detail

deleteDirectory

public static void deleteDirectory(java.io.File directory)
                            throws java.io.IOException
Deletes a directory recursively.

Parameters:
directory - directory to delete
Throws:
java.io.IOException - in case deletion is unsuccessful

cleanDirectory

public static void cleanDirectory(java.io.File directory)
                           throws java.io.IOException
Cleans a directory without deleting it.

Parameters:
directory - directory to clean
Throws:
java.io.IOException - in case cleaning is unsuccessful

forceDelete

public static void forceDelete(java.io.File file)
                        throws java.io.IOException
Deletes a file. If file is a directory, delete it and all sub-directories.

The difference between File.delete() and this method are:

Parameters:
file - file or directory to delete, must not be null
Throws:
java.lang.NullPointerException - if the directory is null
java.io.FileNotFoundException - if the file was not found
java.io.IOException - in case deletion is unsuccessful

forceDeleteOnExit

public static void forceDeleteOnExit(java.io.File file)
                              throws java.io.IOException
Schedules a file to be deleted when JVM exits. If file is directory delete it and all sub-directories.

Parameters:
file - file or directory to delete, must not be null
Throws:
java.lang.NullPointerException - if the file is null
java.io.IOException - in case deletion is unsuccessful


Copyright © 2000-2009 Apache Software Foundation. All Rights Reserved.