Class SearchDirectory


public class SearchDirectory extends FilesProviderWithDirectoryString
Searches a directory for files whose paths match a particular predicate.

By default, the search does not occur recursively, but the bean-property recursive enables this.

Author:
Owen Feehan
  • Constructor Details

    • SearchDirectory

      public SearchDirectory(String directory)
      Create for a specific directory.
      Parameters:
      directory - the directory to search.
    • SearchDirectory

      public SearchDirectory()
  • Method Details

    • matchingFilesForDirectory

      public List<File> matchingFilesForDirectory(Path directory, InputManagerParameters parameters) throws FilesProviderException
      Description copied from class: FilesProviderWithDirectory
      The matching files for this provider that exist in a particular directory.

      This directory may or may not be searched recursively, depending on implementation.

      Specified by:
      matchingFilesForDirectory in class FilesProviderWithDirectory
      Parameters:
      directory - the directory.
      parameters - parameters passed to an InputManager to generate input-objects.
      Returns:
      a newly created list of matching files.
      Throws:
      FilesProviderException - if the operation is unable to complete successfully.
    • setFileFilterAndDirectory

      public void setFileFilterAndDirectory(Path combinedFileFilter)
      Sets both the directory and the glob from a string containing both.

      e.g. somefilepath/*.tif or somefilepath\*.tif

      Parameters:
      combinedFileFilter - a string with both a directory and a glob, as per above.
    • getMatcher

      public FilePathMatcher getMatcher()
    • setMatcher

      public void setMatcher(FilePathMatcher matcher)
    • isRecursive

      public boolean isRecursive()
      If true the search is applied recursively over sub-directories.
    • setRecursive

      public void setRecursive(boolean recursive)
      If true the search is applied recursively over sub-directories.
    • getMaxDirectoryDepth

      public int getMaxDirectoryDepth()
      If non-negative the max depth of directories. If -1, then there is no maximum depth.
    • setMaxDirectoryDepth

      public void setMaxDirectoryDepth(int maxDirectoryDepth)
      If non-negative the max depth of directories. If -1, then there is no maximum depth.
    • isIgnoreHidden

      public boolean isIgnoreHidden()
      If true, case is ignored in the pattern matching. Otherwise the system-default is used i.e. Windows ignores case, Linux doesn't.
    • setIgnoreHidden

      public void setIgnoreHidden(boolean ignoreHidden)
      If true, case is ignored in the pattern matching. Otherwise the system-default is used i.e. Windows ignores case, Linux doesn't.
    • isAcceptDirectoryErrors

      public boolean isAcceptDirectoryErrors()
      If true, continues when a directory-access-error occurs (logging it), otherwise throws an exception.
    • setAcceptDirectoryErrors

      public void setAcceptDirectoryErrors(boolean acceptDirectoryErrors)
      If true, continues when a directory-access-error occurs (logging it), otherwise throws an exception.