Class RecursiveFileSearch


  • public class RecursiveFileSearch
    extends java.lang.Object
    Recursively search a directory, its subdirectories, etc. Note that the search algorithm uses a worklist, so its implementation does not use recursive method calls.
    Author:
    David Hovemeyer
    • Constructor Summary

      Constructors 
      Constructor Description
      RecursiveFileSearch​(java.lang.String baseDir, java.io.FileFilter fileFilter)
      Constructor.
    • Constructor Detail

      • RecursiveFileSearch

        public RecursiveFileSearch​(java.lang.String baseDir,
                                   java.io.FileFilter fileFilter)
        Constructor.
        Parameters:
        baseDir - the base directory for the search
        fileFilter - chooses files to add to the results, and subdirectories to continue the search in
    • Method Detail

      • search

        public RecursiveFileSearch search()
                                   throws java.lang.InterruptedException
        Perform the search.
        Returns:
        this object
        Throws:
        java.lang.InterruptedException - if the thread is interrupted before the search completes
      • fileNameIterator

        public java.util.Iterator<java.lang.String> fileNameIterator()
        Get an iterator over the files found by the search. The full path names of the files are returned.
      • getDirectoriesScanned

        public java.util.List<java.lang.String> getDirectoriesScanned()