Class PathFinder

  • All Implemented Interfaces:
    java.nio.file.FileVisitor<java.nio.file.Path>

    public class PathFinder
    extends java.nio.file.SimpleFileVisitor<java.nio.file.Path>
    • Constructor Summary

      Constructors 
      Constructor Description
      PathFinder()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.nio.file.PathMatcher getDirMatcher()  
      java.nio.file.PathMatcher getFileMatcher()  
      java.util.List<java.io.File> getHitList()  
      java.util.Collection<java.nio.file.Path> getHits()  
      boolean isIncludeDirsInResults()  
      java.nio.file.FileVisitResult preVisitDirectory​(java.nio.file.Path dir, java.nio.file.attribute.BasicFileAttributes attrs)  
      void setBase​(java.nio.file.Path basePath)
      Set the active basePath, used for resolving relative paths.
      void setDirMatcher​(java.nio.file.PathMatcher dirMatcher)  
      void setFileMatcher​(java.lang.String pattern)  
      void setFileMatcher​(java.nio.file.PathMatcher fileMatcher)  
      void setIncludeDirsInResults​(boolean includeDirsInResults)  
      java.nio.file.FileVisitResult visitFile​(java.nio.file.Path file, java.nio.file.attribute.BasicFileAttributes attrs)  
      java.nio.file.FileVisitResult visitFileFailed​(java.nio.file.Path file, java.io.IOException exc)  
      • Methods inherited from class java.nio.file.SimpleFileVisitor

        postVisitDirectory
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PathFinder

        public PathFinder()
    • Method Detail

      • getDirMatcher

        public java.nio.file.PathMatcher getDirMatcher()
      • getFileMatcher

        public java.nio.file.PathMatcher getFileMatcher()
      • getHitList

        public java.util.List<java.io.File> getHitList()
      • getHits

        public java.util.Collection<java.nio.file.Path> getHits()
      • isIncludeDirsInResults

        public boolean isIncludeDirsInResults()
      • preVisitDirectory

        public java.nio.file.FileVisitResult preVisitDirectory​(java.nio.file.Path dir,
                                                               java.nio.file.attribute.BasicFileAttributes attrs)
                                                        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
      • setBase

        public void setBase​(java.nio.file.Path basePath)
        Set the active basePath, used for resolving relative paths.

        When a hit arrives for a subsequent find that has the same relative path as a prior hit, the new hit overrides the prior path as the active hit.

        Parameters:
        basePath - the basePath to tag all hits with
      • setDirMatcher

        public void setDirMatcher​(java.nio.file.PathMatcher dirMatcher)
      • setFileMatcher

        public void setFileMatcher​(java.nio.file.PathMatcher fileMatcher)
      • setFileMatcher

        public void setFileMatcher​(java.lang.String pattern)
      • setIncludeDirsInResults

        public void setIncludeDirsInResults​(boolean includeDirsInResults)
      • visitFile

        public java.nio.file.FileVisitResult visitFile​(java.nio.file.Path file,
                                                       java.nio.file.attribute.BasicFileAttributes attrs)
                                                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
      • visitFileFailed

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