public final class DeleteFileExtensions
extends java.lang.Object
DeleteFileExtensions helps you delete files.| Modifier and Type | Method and Description |
|---|---|
static java.lang.Exception |
checkFile(java.io.File file)
Checks the File if it is a directory or if its exists or if it is empty.
|
static void |
delete(java.util.Collection<java.io.File> files)
Tries to delete all given files in the list.
|
static void |
delete(java.io.File file)
Tries to delete a file and if its a directory than its deletes all the sub-directories.
|
static void |
deleteAllFiles(java.io.File file)
Deletes the File and if it is an directory it deletes his sub-directories recursively.
|
static void |
deleteAllFilesWithSuffix(java.io.File file,
java.lang.String theSuffix)
Deletes all files with the given suffix recursively.
|
static void |
deleteFile(java.io.File fileToDelete)
Tries to delete the given file.
|
static void |
deleteFiles(java.io.File file)
Tries to delete all files in the Directory.
|
static void |
deleteFilesWithFileFilter(java.io.File source,
java.io.FileFilter includeFileFilter)
Tries to delete all files that match to the given includeFileFilter from the given source
directory.
|
static void |
deleteFilesWithFileFilter(java.io.File source,
java.io.FileFilter includeFileFilter,
java.io.FileFilter excludeFileFilter)
Tries to delete all files that match to the given includeFileFilter and does not delete the
files that match the excludeFileFilter from the given source directory.
|
static void |
deleteFilesWithFilenameFilter(java.io.File source,
java.io.FilenameFilter includeFilenameFilter)
Tries to delete all files that match to the given includeFilenameFilter from the given source
directory.
|
static void |
deleteFilesWithFilenameFilter(java.io.File source,
java.io.FilenameFilter includeFilenameFilter,
java.io.FilenameFilter excludeFilenameFilter)
Tries to delete all files that match to the given includeFilenameFilter and does not delete
the files that match the excludeFilenameFilter from the given source directory.
|
public static java.lang.Exception checkFile(java.io.File file)
file - The File to check.public static void delete(java.util.Collection<java.io.File> files)
throws java.io.IOException
files - The files to delete.java.io.IOException - Signals that an I/O exception has occurred.public static void delete(java.io.File file)
throws java.io.IOException
file - The File to delete.java.io.IOException - Signals that an I/O exception has occurred.public static void deleteAllFiles(java.io.File file)
throws java.io.IOException
file - The File to delete.java.io.IOException - Signals that an I/O exception has occurred.public static void deleteAllFilesWithSuffix(java.io.File file,
java.lang.String theSuffix)
throws java.io.IOException
file - The directory from where to delete the files wiht the given suffix.theSuffix - The suffix from the files to delete.java.io.IOException - Signals that an I/O exception has occurred.public static void deleteFile(java.io.File fileToDelete)
throws java.io.IOException
fileToDelete - The file to delete.java.io.IOException - Signals that an I/O exception has occurred.public static void deleteFiles(java.io.File file)
throws java.io.IOException
file - The Directory to delete files.java.io.IOException - Signals that an I/O exception has occurred.public static void deleteFilesWithFileFilter(java.io.File source,
java.io.FileFilter includeFileFilter)
throws FileIsNotADirectoryException,
java.io.IOException,
FileIsSecurityRestrictedException
source - The source directory.includeFileFilter - The FileFilter for the files to be deleted. If null all files will be deleted.FileIsNotADirectoryException - Is thrown if the destination file is a directory.java.io.IOException - Is thrown if an error occurs by reading or writing.FileIsSecurityRestrictedException - Is thrown if the source file is security restricted.public static void deleteFilesWithFileFilter(java.io.File source,
java.io.FileFilter includeFileFilter,
java.io.FileFilter excludeFileFilter)
throws FileIsNotADirectoryException,
java.io.IOException,
FileIsSecurityRestrictedException
source - The source directory.includeFileFilter - The FileFilter for the files to be deleted. If null all files will be deleted.excludeFileFilter - The FileFilter for the files to be not deleted. If null no files will be excluded
by delete process.FileIsNotADirectoryException - Is thrown if the destination file is a directory.java.io.IOException - Is thrown if an error occurs by reading or writing.FileIsSecurityRestrictedException - Is thrown if the source file is security restricted.public static void deleteFilesWithFilenameFilter(java.io.File source,
java.io.FilenameFilter includeFilenameFilter)
throws FileIsNotADirectoryException,
java.io.IOException,
FileIsSecurityRestrictedException
source - The source directory.includeFilenameFilter - The FilenameFilter for the files to be deleted. If null all files will be deleted.FileIsNotADirectoryException - Is thrown if the destination file is a directory.java.io.IOException - Is thrown if an error occurs by reading or writing.FileIsSecurityRestrictedException - Is thrown if the source file is security restricted.public static void deleteFilesWithFilenameFilter(java.io.File source,
java.io.FilenameFilter includeFilenameFilter,
java.io.FilenameFilter excludeFilenameFilter)
throws FileIsNotADirectoryException,
java.io.IOException,
FileIsSecurityRestrictedException
source - The source directory.includeFilenameFilter - The FilenameFilter for the files to be deleted. If null all files will be deleted.excludeFilenameFilter - The FilenameFilter for the files to be not deleted. If null no files will be
excluded by delete process.FileIsNotADirectoryException - Is thrown if the destination file is a directory.java.io.IOException - Is thrown if an error occurs by reading or writing.FileIsSecurityRestrictedException - Is thrown if the source file is security restricted.