Class RegexpFileFilter

java.lang.Object
net.sf.basedb.util.RegexpFileFilter
All Implemented Interfaces:
FileFilter

public class RegexpFileFilter
extends Object
implements FileFilter
An implementation of the FileFilter interface that filter files and directories based on regular expressions.
Version:
2.5
Author:
nicklas
Last modified
$Date: 2012-09-14 09:28:35 +0200 (fr, 14 sep 2012) $
  • Field Details

    • filePattern

      private final Pattern filePattern
    • directoryPattern

      private final Pattern directoryPattern
  • Constructor Details

    • RegexpFileFilter

      public RegexpFileFilter​(String fileRegexp, String directoryRegexp)
      Create a new file filter from a string regular expressions.
      Parameters:
      fileRegexp - The regular expression used to match file names or null to match all files
      directoryRegexp - The regular expression used to match directory names or null to match all directories
    • RegexpFileFilter

      public RegexpFileFilter​(Pattern filePattern, Pattern directoryPattern)
      Create a new file filter from patterns.
      Parameters:
      filePattern - The pattern used to match file names, or null to match all files
      directoryPattern - The pattern used to match the directory names, or null to match all directories
  • Method Details

    • accept

      public boolean accept​(File file)
      Accept files with a name matching the regular expression
      Specified by:
      accept in interface FileFilter