public class FileUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static long |
MILLIS_BETWEEN_ATTEMPTS |
| Constructor and Description |
|---|
FileUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
deleteFile(File file,
boolean recurse) |
static boolean |
deleteFile(File file,
org.slf4j.Logger logger)
Deletes the given file.
|
static boolean |
deleteFile(File file,
org.slf4j.Logger logger,
int attempts)
Deletes the given file.
|
static void |
deleteFiles(Collection<File> files,
boolean recurse)
Deletes given files.
|
static void |
deleteFilesInDirectory(File directory,
FilenameFilter filter,
org.slf4j.Logger logger)
Deletes all files (not directories..) in the given directory (non
recursive) that match the given filename filter.
|
static void |
deleteFilesInDirectory(File directory,
FilenameFilter filter,
org.slf4j.Logger logger,
boolean recurse)
Deletes all files (not directories) in the given directory (recursive)
that match the given filename filter.
|
static void |
deleteFilesInDirectory(File directory,
FilenameFilter filter,
org.slf4j.Logger logger,
boolean recurse,
boolean deleteEmptyDirectories)
Deletes all files (not directories) in the given directory (recursive)
that match the given filename filter.
|
static void |
ensureDirectoryExistAndCanRead(File dir) |
static void |
ensureDirectoryExistAndCanReadAndWrite(File dir) |
static boolean |
mayBeANarArchive(File jarFile) |
static void |
sleepQuietly(long millis) |
public static final long MILLIS_BETWEEN_ATTEMPTS
public static void ensureDirectoryExistAndCanReadAndWrite(File dir) throws IOException
IOExceptionpublic static void ensureDirectoryExistAndCanRead(File dir) throws IOException
IOExceptionpublic static boolean deleteFile(File file, org.slf4j.Logger logger)
file - to deletelogger - to notifypublic static boolean deleteFile(File file, org.slf4j.Logger logger, int attempts)
file - to deletelogger - to notifyattempts - indicates how many times an attempt to delete should be
madepublic static void deleteFilesInDirectory(File directory, FilenameFilter filter, org.slf4j.Logger logger) throws IOException
directory - to delete contents offilter - if null then no filter is usedlogger - to notifyIOException - if abstract pathname does not denote a directory, or
if an I/O error occurspublic static void deleteFilesInDirectory(File directory, FilenameFilter filter, org.slf4j.Logger logger, boolean recurse) throws IOException
directory - to delete contents offilter - if null then no filter is usedlogger - to notifyrecurse - true if should recurseIOException - if abstract pathname does not denote a directory, or
if an I/O error occurspublic static void deleteFilesInDirectory(File directory, FilenameFilter filter, org.slf4j.Logger logger, boolean recurse, boolean deleteEmptyDirectories) throws IOException
directory - to delete contents offilter - if null then no filter is usedlogger - to notifyrecurse - will look for contents of sub directories.deleteEmptyDirectories - default is false; if true will delete
directories found that are emptyIOException - if abstract pathname does not denote a directory, or
if an I/O error occurspublic static void deleteFiles(Collection<File> files, boolean recurse) throws IOException
files - to deleterecurse - will recurseIOException - if issues deleting filespublic static void deleteFile(File file, boolean recurse) throws IOException
IOExceptionpublic static void sleepQuietly(long millis)
public static boolean mayBeANarArchive(File jarFile)
Copyright © 2017–2021 Apache Software Foundation. All rights reserved.