Package org.apache.commons.io.file
Class CountingPathVisitor
java.lang.Object
java.nio.file.SimpleFileVisitor<Path>
org.apache.commons.io.file.SimplePathVisitor
org.apache.commons.io.file.CountingPathVisitor
- All Implemented Interfaces:
FileVisitor<Path>,PathVisitor
- Direct Known Subclasses:
AccumulatorPathVisitor,CleaningPathVisitor,CopyDirectoryVisitor,DeletingPathVisitor
Counts files, directories, and sizes, as a visit proceeds.
- Since:
- 2.7
-
Constructor Summary
ConstructorsConstructorDescriptionCountingPathVisitor(Counters.PathCounters pathCounter) Constructs a new instance.CountingPathVisitor(Counters.PathCounters pathCounter, PathFilter fileFilter, PathFilter dirFilter) Constructs a new instance.CountingPathVisitor(Counters.PathCounters pathCounter, PathFilter fileFilter, PathFilter dirFilter, IOBiFunction<Path, IOException, FileVisitResult> visitFileFailed) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the visitation counts.inthashCode()postVisitDirectory(Path dir, IOException exc) preVisitDirectory(Path dir, BasicFileAttributes attributes) toString()visitFile(Path file, BasicFileAttributes attributes) static CountingPathVisitorConstructs a new instance configured with aBigIntegerCounters.PathCounters.static CountingPathVisitorConstructs a new instance configured with alongCounters.PathCounters.Methods inherited from class org.apache.commons.io.file.SimplePathVisitor
visitFileFailed
-
Constructor Details
-
CountingPathVisitor
Constructs a new instance.- Parameters:
pathCounter- How to count path visits.
-
CountingPathVisitor
public CountingPathVisitor(Counters.PathCounters pathCounter, PathFilter fileFilter, PathFilter dirFilter) Constructs a new instance.- Parameters:
pathCounter- How to count path visits.fileFilter- Filters which files to count.dirFilter- Filters which directories to count.- Since:
- 2.9.0
-
CountingPathVisitor
public CountingPathVisitor(Counters.PathCounters pathCounter, PathFilter fileFilter, PathFilter dirFilter, IOBiFunction<Path, IOException, FileVisitResult> visitFileFailed) Constructs a new instance.- Parameters:
pathCounter- How to count path visits.fileFilter- Filters which files to count.dirFilter- Filters which directories to count.visitFileFailed- Called onSimplePathVisitor.visitFileFailed(Path, IOException).- Since:
- 2.12.0
-
-
Method Details
-
withBigIntegerCounters
Constructs a new instance configured with aBigIntegerCounters.PathCounters.- Returns:
- a new instance configured with a
BigIntegerCounters.PathCounters.
-
withLongCounters
Constructs a new instance configured with alongCounters.PathCounters.- Returns:
- a new instance configured with a
longCounters.PathCounters.
-
equals
-
getPathCounters
Gets the visitation counts.- Returns:
- the visitation counts.
-
hashCode
public int hashCode() -
postVisitDirectory
- Specified by:
postVisitDirectoryin interfaceFileVisitor<Path>- Overrides:
postVisitDirectoryin classSimpleFileVisitor<Path>- Throws:
IOException
-
preVisitDirectory
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attributes) throws IOException - Specified by:
preVisitDirectoryin interfaceFileVisitor<Path>- Overrides:
preVisitDirectoryin classSimpleFileVisitor<Path>- Throws:
IOException
-
toString
-
visitFile
- Specified by:
visitFilein interfaceFileVisitor<Path>- Overrides:
visitFilein classSimpleFileVisitor<Path>- Throws:
IOException
-