Class RegexPathFilter

java.lang.Object
com.ganteater.ae.util.RegexPathFilter
All Implemented Interfaces:
FileFilter, FilenameFilter, PathMatcher, org.apache.commons.io.file.PathFilter, org.apache.commons.io.filefilter.IOFileFilter

public class RegexPathFilter extends Object implements org.apache.commons.io.filefilter.IOFileFilter
  • Field Summary

    Fields inherited from interface org.apache.commons.io.filefilter.IOFileFilter

    EMPTY_STRING_ARRAY
  • Constructor Summary

    Constructors
    Constructor
    Description
    RegexPathFilter(String fileFilterRegex, String dirFilterRegex)
    Constructor to compile the regex pattern.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    accept(File file)
    This method is called by FileUtils.listFiles when checking a file's directory.
    boolean
    accept(File dir, String name)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.commons.io.filefilter.IOFileFilter

    accept, and, matches, negate, or
  • Constructor Details

    • RegexPathFilter

      public RegexPathFilter(String fileFilterRegex, String dirFilterRegex)
      Constructor to compile the regex pattern.
      Parameters:
      fileFilterRegex - The regular expression to match against the file name.
      dirFilterRegex - The regular expression to match against the full path.
      fileFilterRegex -
  • Method Details

    • accept

      public boolean accept(File file)
      This method is called by FileUtils.listFiles when checking a file's directory. The `file` parameter is the directory being scanned.
      Specified by:
      accept in interface FileFilter
      Specified by:
      accept in interface org.apache.commons.io.filefilter.IOFileFilter
      Parameters:
      file - The directory to check.
      Returns:
      true if the directory's full path matches the regex, false otherwise.
    • accept

      public boolean accept(File dir, String name)
      Specified by:
      accept in interface FilenameFilter
      Specified by:
      accept in interface org.apache.commons.io.filefilter.IOFileFilter