Documentation of 'org.clapper.util.io.RegexFilenameFilter' Java class
RegexFilenameFilter
org.clapper.util.io

Class RegexFilenameFilter

  • All Implemented Interfaces:
    java.io.FilenameFilter


    public class RegexFilenameFilter
    extends java.lang.Object
    implements java.io.FilenameFilter

    RegexFilenameFilter implements a java.io.FilenameFilter class that matches files using a regular expression. Multiple regular expression filters can be combined using AndFilenameFilter and/or OrFilenameFilter objects.

    A RegexFilenameFilter can be configured to operate on just the simple file name, or on the file's path.

    RegexFilenameFilter uses the java.util.regex regular expression classes.

    See Also:
    AndFilenameFilter, OrFilenameFilter, NotFilenameFilter, RegexFileFilter
    • Constructor Summary

      Constructors 
      Constructor and Description
      RegexFilenameFilter(java.lang.String regex)
      Construct a new RegexFilenameFilter using the specified pattern, with an implied match type of FileFilterMatchType.FILENAME.
      RegexFilenameFilter(java.lang.String regex, FileFilterMatchType matchType)
      Construct a new RegexFilenameFilter using the specified pattern.
      RegexFilenameFilter(java.lang.String regex, int regexFlags, FileFilterMatchType matchType)
      Construct a new RegexFilenameFilter using the specified pattern.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean accept(java.io.File dir, java.lang.String name)
      Determine whether a file is to be accepted or not, based on the regular expressions in the reject and accept lists.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RegexFilenameFilter

        public RegexFilenameFilter(java.lang.String regex)
                            throws java.util.regex.PatternSyntaxException
        Construct a new RegexFilenameFilter using the specified pattern, with an implied match type of FileFilterMatchType.FILENAME.
        Parameters:
        regex - the regular expression to add
        Throws:
        java.util.regex.PatternSyntaxException - bad regular expression
      • RegexFilenameFilter

        public RegexFilenameFilter(java.lang.String regex,
                                   FileFilterMatchType matchType)
                            throws java.util.regex.PatternSyntaxException
        Construct a new RegexFilenameFilter using the specified pattern.
        Parameters:
        regex - the regular expression to add
        matchType - FileFilterMatchType.FILENAME to match just the filename, FileFilterMatchType.PATH to match the path (via java.io.File.getPath())
        Throws:
        java.util.regex.PatternSyntaxException - bad regular expression
      • RegexFilenameFilter

        public RegexFilenameFilter(java.lang.String regex,
                                   int regexFlags,
                                   FileFilterMatchType matchType)
                            throws java.util.regex.PatternSyntaxException
        Construct a new RegexFilenameFilter using the specified pattern.
        Parameters:
        regex - the regular expression to add
        regexFlags - regular expression compilation flags (e.g., Pattern.CASE_INSENSITIVE). See the Javadocs for java.util.regex for legal values.
        matchType - FileFilterMatchType.FILENAME to match just the filename, FileFilterMatchType.PATH to match the path (via java.io.File.getPath())
        Throws:
        java.util.regex.PatternSyntaxException - bad regular expression
    • Method Detail

      • accept

        public boolean accept(java.io.File dir,
                              java.lang.String name)
        Determine whether a file is to be accepted or not, based on the regular expressions in the reject and accept lists.
        Specified by:
        accept in interface java.io.FilenameFilter
        Parameters:
        dir - The directory containing the file. Ignored if the match type is FileFilterMatchType.FILENAME. Used to build the path to match when the match type is FileFilterMatchType.PATH
        name - the file name
        Returns:
        true if the file matches, false if it doesn't

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.