Package org.apache.commons.io.file
Class DeletingPathVisitor
java.lang.Object
java.nio.file.SimpleFileVisitor<Path>
org.apache.commons.io.file.SimplePathVisitor
org.apache.commons.io.file.CountingPathVisitor
org.apache.commons.io.file.DeletingPathVisitor
- All Implemented Interfaces:
FileVisitor<Path>
,PathVisitor
Deletes files and directories as a visit proceeds.
- Since:
- 2.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LinkOption[]
private final boolean
private final String[]
Fields inherited from class org.apache.commons.io.file.CountingPathVisitor
EMPTY_STRING_ARRAY
-
Constructor Summary
ConstructorsConstructorDescriptionDeletingPathVisitor
(Counters.PathCounters pathCounter, String... skip) Constructs a new visitor that deletes files except for the files and directories explicitly given.DeletingPathVisitor
(Counters.PathCounters pathCounter, LinkOption[] linkOptions, DeleteOption[] deleteOption, String... skip) Constructs a new visitor that deletes files except for the files and directories explicitly given.DeletingPathVisitor
(Counters.PathCounters pathCounter, DeleteOption[] deleteOption, String... skip) Constructs a new visitor that deletes files except for the files and directories explicitly given. -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
Returns true to process the given path, false if not.boolean
int
hashCode()
postVisitDirectory
(Path dir, IOException exc) preVisitDirectory
(Path dir, BasicFileAttributes attrs) visitFile
(Path file, BasicFileAttributes attrs) static DeletingPathVisitor
Constructs a new instance configured with a BigIntegerCounters.PathCounters
.static DeletingPathVisitor
Constructs a new instance configured with a longCounters.PathCounters
.Methods inherited from class org.apache.commons.io.file.CountingPathVisitor
defaultDirFilter, defaultFileFilter, getPathCounters, toString, updateDirCounter, updateFileCounters
Methods inherited from class org.apache.commons.io.file.SimplePathVisitor
visitFileFailed
-
Field Details
-
skip
-
overrideReadOnly
private final boolean overrideReadOnly -
linkOptions
-
-
Constructor Details
-
DeletingPathVisitor
public DeletingPathVisitor(Counters.PathCounters pathCounter, DeleteOption[] deleteOption, String... skip) Constructs a new visitor that deletes files except for the files and directories explicitly given.- Parameters:
pathCounter
- How to count visits.deleteOption
- How deletion is handled.skip
- The files to skip deleting.- Since:
- 2.8.0
-
DeletingPathVisitor
public DeletingPathVisitor(Counters.PathCounters pathCounter, LinkOption[] linkOptions, DeleteOption[] deleteOption, String... skip) Constructs a new visitor that deletes files except for the files and directories explicitly given.- Parameters:
pathCounter
- How to count visits.linkOptions
- How symbolic links are handled.deleteOption
- How deletion is handled.skip
- The files to skip deleting.- Since:
- 2.9.0
-
DeletingPathVisitor
Constructs a new visitor that deletes files except for the files and directories explicitly given.- Parameters:
pathCounter
- How to count visits.skip
- The files to skip deleting.
-
-
Method Details
-
withBigIntegerCounters
Constructs a new instance configured with a BigIntegerCounters.PathCounters
.- Returns:
- a new instance configured with a BigInteger
Counters.PathCounters
.
-
withLongCounters
Constructs a new instance configured with a longCounters.PathCounters
.- Returns:
- a new instance configured with a long
Counters.PathCounters
.
-
accept
Returns true to process the given path, false if not.- Parameters:
path
- the path to test.- Returns:
- true to process the given path, false if not.
-
equals
- Overrides:
equals
in classCountingPathVisitor
-
hashCode
public int hashCode()- Overrides:
hashCode
in classCountingPathVisitor
-
postVisitDirectory
- Specified by:
postVisitDirectory
in interfaceFileVisitor<Path>
- Overrides:
postVisitDirectory
in classCountingPathVisitor
- Throws:
IOException
-
preVisitDirectory
- Specified by:
preVisitDirectory
in interfaceFileVisitor<Path>
- Overrides:
preVisitDirectory
in classCountingPathVisitor
- Throws:
IOException
-
visitFile
- Specified by:
visitFile
in interfaceFileVisitor<Path>
- Overrides:
visitFile
in classCountingPathVisitor
- Throws:
IOException
-