Class RegexFileFilter

java.lang.Object
net.shibboleth.metadata.util.RegexFileFilter
All Implemented Interfaces:
FileFilter

@Immutable public class RegexFileFilter extends Object implements FileFilter
A FileFilter implementation that selects files on the basis of a regular expression match against the file name.
Since:
0.10.0
  • Field Details

    • pattern

      private final Pattern pattern
      Compiled regular expression.
  • Constructor Details

    • RegexFileFilter

      public RegexFileFilter(@Nonnull @NotEmpty String regex)
      Constructor.
      Parameters:
      regex - Regular expression to match file names against.
  • Method Details

    • accept

      public boolean accept(File pathname)
      Matches the regular expression against the last file name component of the supplied File object. As the whole of the name is being matched against, it is not necessary for the regular expression to contain anchor characters such as '^' and '$'.
      Specified by:
      accept in interface FileFilter
      Parameters:
      pathname - File to match against the regular expression.
      Returns:
      true iff pathname matches the regular expression.