class Cleaner
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static interface |
Cleaner.Logger |
private static class |
Cleaner.Result |
Modifier and Type | Field and Description |
---|---|
private Cleaner.Logger |
logDebug |
private Cleaner.Logger |
logInfo |
private Cleaner.Logger |
logVerbose |
private Cleaner.Logger |
logWarn |
private static boolean |
ON_WINDOWS |
Constructor and Description |
---|
Cleaner(org.apache.maven.plugin.logging.Log log,
boolean verbose)
Creates a new cleaner.
|
Modifier and Type | Method and Description |
---|---|
private int |
delete(java.io.File file,
boolean failOnError,
boolean retryOnError)
Deletes the specified file, directory.
|
void |
delete(java.io.File basedir,
Selector selector,
boolean followSymlinks,
boolean failOnError,
boolean retryOnError)
Deletes the specified directories and its contents.
|
private Cleaner.Result |
delete(java.io.File file,
java.lang.String pathname,
Selector selector,
boolean followSymlinks,
boolean failOnError,
boolean retryOnError)
Deletes the specified file or directory.
|
private static final boolean ON_WINDOWS
private final Cleaner.Logger logDebug
private final Cleaner.Logger logInfo
private final Cleaner.Logger logVerbose
private final Cleaner.Logger logWarn
public Cleaner(org.apache.maven.plugin.logging.Log log, boolean verbose)
log
- The logger to use, may be null
to disable logging.verbose
- Whether to perform verbose logging.public void delete(java.io.File basedir, Selector selector, boolean followSymlinks, boolean failOnError, boolean retryOnError) throws java.io.IOException
basedir
- The directory to delete, must not be null
. Non-existing directories will be silently
ignored.selector
- The selector used to determine what contents to delete, may be null
to delete
everything.followSymlinks
- Whether to follow symlinks.failOnError
- Whether to abort with an exception in case a selected file/directory could not be deleted.retryOnError
- Whether to undertake additional delete attempts in case the first attempt failed.java.io.IOException
- If a file/directory could not be deleted and failOnError
is true
.private Cleaner.Result delete(java.io.File file, java.lang.String pathname, Selector selector, boolean followSymlinks, boolean failOnError, boolean retryOnError) throws java.io.IOException
file
- The file/directory to delete, must not be null
. If followSymlinks
is
false
, it is assumed that the parent file is canonical.pathname
- The relative pathname of the file, using File.separatorChar
, must not be
null
.selector
- The selector used to determine what contents to delete, may be null
to delete
everything.followSymlinks
- Whether to follow symlinks.failOnError
- Whether to abort with an exception in case a selected file/directory could not be deleted.retryOnError
- Whether to undertake additional delete attempts in case the first attempt failed.null
.java.io.IOException
- If a file/directory could not be deleted and failOnError
is true
.private int delete(java.io.File file, boolean failOnError, boolean retryOnError) throws java.io.IOException
file
- The file/directory to delete, must not be null
.failOnError
- Whether to abort with an exception in case the file/directory could not be deleted.retryOnError
- Whether to undertake additional delete attempts in case the first attempt failed.0
if the file was deleted, 1
otherwise.java.io.IOException
- If a file/directory could not be deleted and failOnError
is true
.