public class CountingPathVisitor extends SimplePathVisitor
| Modifier and Type | Field and Description |
|---|---|
private PathFilter |
dirFilter |
(package private) static java.lang.String[] |
EMPTY_STRING_ARRAY |
private PathFilter |
fileFilter |
private Counters.PathCounters |
pathCounters |
| Constructor and Description |
|---|
CountingPathVisitor(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<java.nio.file.Path,java.io.IOException,java.nio.file.FileVisitResult> visitFileFailed)
Constructs a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) static IOFileFilter |
defaultDirFilter() |
(package private) static IOFileFilter |
defaultFileFilter() |
boolean |
equals(java.lang.Object obj) |
Counters.PathCounters |
getPathCounters()
Gets the visitation counts.
|
int |
hashCode() |
java.nio.file.FileVisitResult |
postVisitDirectory(java.nio.file.Path dir,
java.io.IOException exc) |
java.nio.file.FileVisitResult |
preVisitDirectory(java.nio.file.Path dir,
java.nio.file.attribute.BasicFileAttributes attributes) |
java.lang.String |
toString() |
protected void |
updateDirCounter(java.nio.file.Path dir,
java.io.IOException exc)
Updates the counter for visiting the given directory.
|
protected void |
updateFileCounters(java.nio.file.Path file,
java.nio.file.attribute.BasicFileAttributes attributes)
Updates the counters for visiting the given file.
|
java.nio.file.FileVisitResult |
visitFile(java.nio.file.Path file,
java.nio.file.attribute.BasicFileAttributes attributes) |
static CountingPathVisitor |
withBigIntegerCounters()
Constructs a new instance configured with a
BigInteger Counters.PathCounters. |
static CountingPathVisitor |
withLongCounters()
Constructs a new instance configured with a
long Counters.PathCounters. |
visitFileFailedstatic final java.lang.String[] EMPTY_STRING_ARRAY
private final Counters.PathCounters pathCounters
private final PathFilter fileFilter
private final PathFilter dirFilter
public CountingPathVisitor(Counters.PathCounters pathCounter)
pathCounter - How to count path visits.public CountingPathVisitor(Counters.PathCounters pathCounter, PathFilter fileFilter, PathFilter dirFilter)
pathCounter - How to count path visits.fileFilter - Filters which files to count.dirFilter - Filters which directories to count.public CountingPathVisitor(Counters.PathCounters pathCounter, PathFilter fileFilter, PathFilter dirFilter, IOBiFunction<java.nio.file.Path,java.io.IOException,java.nio.file.FileVisitResult> visitFileFailed)
pathCounter - How to count path visits.fileFilter - Filters which files to count.dirFilter - Filters which directories to count.visitFileFailed - Called on SimplePathVisitor.visitFileFailed(Path, IOException).static IOFileFilter defaultDirFilter()
static IOFileFilter defaultFileFilter()
public static CountingPathVisitor withBigIntegerCounters()
BigInteger Counters.PathCounters.BigInteger Counters.PathCounters.public static CountingPathVisitor withLongCounters()
long Counters.PathCounters.long Counters.PathCounters.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic Counters.PathCounters getPathCounters()
public int hashCode()
hashCode in class java.lang.Objectpublic java.nio.file.FileVisitResult postVisitDirectory(java.nio.file.Path dir,
java.io.IOException exc)
throws java.io.IOException
postVisitDirectory in interface java.nio.file.FileVisitor<java.nio.file.Path>postVisitDirectory in class java.nio.file.SimpleFileVisitor<java.nio.file.Path>java.io.IOExceptionpublic java.nio.file.FileVisitResult preVisitDirectory(java.nio.file.Path dir,
java.nio.file.attribute.BasicFileAttributes attributes)
throws java.io.IOException
preVisitDirectory in interface java.nio.file.FileVisitor<java.nio.file.Path>preVisitDirectory in class java.nio.file.SimpleFileVisitor<java.nio.file.Path>java.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Objectprotected void updateDirCounter(java.nio.file.Path dir,
java.io.IOException exc)
dir - the visited directory.exc - Encountered exception.protected void updateFileCounters(java.nio.file.Path file,
java.nio.file.attribute.BasicFileAttributes attributes)
file - the visited file.attributes - the visited file attributes.public java.nio.file.FileVisitResult visitFile(java.nio.file.Path file,
java.nio.file.attribute.BasicFileAttributes attributes)
throws java.io.IOException
visitFile in interface java.nio.file.FileVisitor<java.nio.file.Path>visitFile in class java.nio.file.SimpleFileVisitor<java.nio.file.Path>java.io.IOException