Class CountingPathVisitor

    • Constructor Detail

      • CountingPathVisitor

        public CountingPathVisitor​(Counters.PathCounters pathCounter)
        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
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • getPathCounters

        public Counters.PathCounters getPathCounters()
        Gets the visitation counts.
        Returns:
        the visitation counts.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • postVisitDirectory

        public java.nio.file.FileVisitResult postVisitDirectory​(java.nio.file.Path dir,
                                                                java.io.IOException exc)
                                                         throws java.io.IOException
        Specified by:
        postVisitDirectory in interface java.nio.file.FileVisitor<java.nio.file.Path>
        Overrides:
        postVisitDirectory in class java.nio.file.SimpleFileVisitor<java.nio.file.Path>
        Throws:
        java.io.IOException
      • preVisitDirectory

        public java.nio.file.FileVisitResult preVisitDirectory​(java.nio.file.Path dir,
                                                               java.nio.file.attribute.BasicFileAttributes attributes)
                                                        throws java.io.IOException
        Specified by:
        preVisitDirectory in interface java.nio.file.FileVisitor<java.nio.file.Path>
        Overrides:
        preVisitDirectory in class java.nio.file.SimpleFileVisitor<java.nio.file.Path>
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • updateDirCounter

        protected void updateDirCounter​(java.nio.file.Path dir,
                                        java.io.IOException exc)
        Updates the counter for visiting the given directory.
        Parameters:
        dir - the visited directory.
        exc - Encountered exception.
        Since:
        2.9.0
      • updateFileCounters

        protected void updateFileCounters​(java.nio.file.Path file,
                                          java.nio.file.attribute.BasicFileAttributes attributes)
        Updates the counters for visiting the given file.
        Parameters:
        file - the visited file.
        attributes - the visited file attributes.
      • visitFile

        public java.nio.file.FileVisitResult visitFile​(java.nio.file.Path file,
                                                       java.nio.file.attribute.BasicFileAttributes attributes)
                                                throws java.io.IOException
        Specified by:
        visitFile in interface java.nio.file.FileVisitor<java.nio.file.Path>
        Overrides:
        visitFile in class java.nio.file.SimpleFileVisitor<java.nio.file.Path>
        Throws:
        java.io.IOException