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>
- Direct Known Subclasses:
AccumulatorPathVisitor
,CleaningPathVisitor
,CopyDirectoryVisitor
,DeletingPathVisitor
Counts files, directories, and sizes, as a visit proceeds.
- Since:
- 2.7
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final String[]
private final Counters.PathCounters
-
Constructor Summary
ConstructorsConstructorDescriptionCountingPathVisitor
(Counters.PathCounters pathCounter) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the visitation counts.int
hashCode()
postVisitDirectory
(Path dir, IOException exc) toString()
protected void
updateFileCounters
(Path file, BasicFileAttributes attributes) Updates the counters for visiting the given file.visitFile
(Path file, BasicFileAttributes attributes) static CountingPathVisitor
Creates a new instance configured with a BigIntegerCounters.PathCounters
.static CountingPathVisitor
Creates a new instance configured with a longCounters.PathCounters
.Methods inherited from class java.nio.file.SimpleFileVisitor
preVisitDirectory, visitFileFailed
-
Field Details
-
EMPTY_STRING_ARRAY
-
pathCounters
-
-
Constructor Details
-
CountingPathVisitor
Constructs a new instance.- Parameters:
pathCounter
- How to count path visits.
-
-
Method Details
-
withBigIntegerCounters
Creates a new instance configured with a BigIntegerCounters.PathCounters
.- Returns:
- a new instance configured with a BigInteger
Counters.PathCounters
.
-
withLongCounters
Creates a new instance configured with a longCounters.PathCounters
.- Returns:
- a new instance configured with a long
Counters.PathCounters
.
-
equals
-
getPathCounters
Gets the visitation counts.- Returns:
- the visitation counts.
-
hashCode
public int hashCode() -
postVisitDirectory
- Specified by:
postVisitDirectory
in interfaceFileVisitor<Path>
- Overrides:
postVisitDirectory
in classSimpleFileVisitor<Path>
- Throws:
IOException
-
toString
-
updateFileCounters
Updates the counters for visiting the given file.- Parameters:
file
- the visited file.attributes
- the visited file attributes.
-
visitFile
- Specified by:
visitFile
in interfaceFileVisitor<Path>
- Overrides:
visitFile
in classSimpleFileVisitor<Path>
- Throws:
IOException
-