Package org.apache.commons.io.file
Class DeletingPathVisitor
- java.lang.Object
-
- java.nio.file.SimpleFileVisitor<java.nio.file.Path>
-
- org.apache.commons.io.file.SimplePathVisitor
-
- org.apache.commons.io.file.CountingPathVisitor
-
- org.apache.commons.io.file.DeletingPathVisitor
-
- All Implemented Interfaces:
java.nio.file.FileVisitor<java.nio.file.Path>,PathVisitor
public class DeletingPathVisitor extends CountingPathVisitor
Deletes files and directories as a visit proceeds.- Since:
- 2.7
-
-
Constructor Summary
Constructors Constructor Description DeletingPathVisitor(Counters.PathCounters pathCounter, java.lang.String... skip)Constructs a new visitor that deletes files except for the files and directories explicitly given.DeletingPathVisitor(Counters.PathCounters pathCounter, java.nio.file.LinkOption[] linkOptions, DeleteOption[] deleteOption, java.lang.String... skip)Constructs a new visitor that deletes files except for the files and directories explicitly given.DeletingPathVisitor(Counters.PathCounters pathCounter, DeleteOption[] deleteOption, java.lang.String... skip)Constructs a new visitor that deletes files except for the files and directories explicitly given.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)inthashCode()java.nio.file.FileVisitResultpostVisitDirectory(java.nio.file.Path dir, java.io.IOException exc)java.nio.file.FileVisitResultpreVisitDirectory(java.nio.file.Path dir, java.nio.file.attribute.BasicFileAttributes attrs)java.nio.file.FileVisitResultvisitFile(java.nio.file.Path file, java.nio.file.attribute.BasicFileAttributes attrs)static DeletingPathVisitorwithBigIntegerCounters()Creates a new instance configured with a BigIntegerCounters.PathCounters.static DeletingPathVisitorwithLongCounters()Creates a new instance configured with a longCounters.PathCounters.-
Methods inherited from class org.apache.commons.io.file.CountingPathVisitor
getPathCounters, toString
-
-
-
-
Constructor Detail
-
DeletingPathVisitor
public DeletingPathVisitor(Counters.PathCounters pathCounter, DeleteOption[] deleteOption, java.lang.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, java.nio.file.LinkOption[] linkOptions, DeleteOption[] deleteOption, java.lang.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
public DeletingPathVisitor(Counters.PathCounters pathCounter, java.lang.String... skip)
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 Detail
-
withBigIntegerCounters
public static DeletingPathVisitor withBigIntegerCounters()
Creates a new instance configured with a BigIntegerCounters.PathCounters.- Returns:
- a new instance configured with a BigInteger
Counters.PathCounters.
-
withLongCounters
public static DeletingPathVisitor withLongCounters()
Creates a new instance configured with a longCounters.PathCounters.- Returns:
- a new instance configured with a long
Counters.PathCounters.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classCountingPathVisitor
-
hashCode
public int hashCode()
- Overrides:
hashCodein classCountingPathVisitor
-
postVisitDirectory
public java.nio.file.FileVisitResult postVisitDirectory(java.nio.file.Path dir, java.io.IOException exc) throws java.io.IOException- Specified by:
postVisitDirectoryin interfacejava.nio.file.FileVisitor<java.nio.file.Path>- Overrides:
postVisitDirectoryin classCountingPathVisitor- Throws:
java.io.IOException
-
preVisitDirectory
public java.nio.file.FileVisitResult preVisitDirectory(java.nio.file.Path dir, java.nio.file.attribute.BasicFileAttributes attrs) throws java.io.IOException- Specified by:
preVisitDirectoryin interfacejava.nio.file.FileVisitor<java.nio.file.Path>- Overrides:
preVisitDirectoryin classCountingPathVisitor- Throws:
java.io.IOException
-
visitFile
public java.nio.file.FileVisitResult visitFile(java.nio.file.Path file, java.nio.file.attribute.BasicFileAttributes attrs) throws java.io.IOException- Specified by:
visitFilein interfacejava.nio.file.FileVisitor<java.nio.file.Path>- Overrides:
visitFilein classCountingPathVisitor- Throws:
java.io.IOException
-
-