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

Class RegexFileFilter

  • All Implemented Interfaces:
    java.io.FileFilter


    public class RegexFileFilter
    extends java.lang.Object
    implements java.io.FileFilter

    RegexFileFilter implements a java.io.FileFilter class that matches files using a regular expression. Multiple regular expression filters can be combined using AndFileFilter and/or OrFileFilter objects.

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

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

    See Also:
    AndFileFilter, OrFileFilter, NotFileFilter, RegexFilenameFilter
    • Constructor Summary

      Constructors 
      Constructor and Description
      RegexFileFilter(java.lang.String regex, FileFilterMatchType matchType)
      Construct a new RegexFileFilter using the specified pattern.
      RegexFileFilter(java.lang.String regex, int regexFlags, FileFilterMatchType matchType)
      Construct a new RegexFileFilter using the specified pattern.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean accept(java.io.File file)
      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

      • RegexFileFilter

        public RegexFileFilter(java.lang.String regex,
                               FileFilterMatchType matchType)
                        throws java.util.regex.PatternSyntaxException
        Construct a new RegexFileFilter 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
      • RegexFileFilter

        public RegexFileFilter(java.lang.String regex,
                               int regexFlags,
                               FileFilterMatchType matchType)
                        throws java.util.regex.PatternSyntaxException
        Construct a new RegexFileFilter 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 file)
        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.FileFilter
        Parameters:
        file - The file to test. If the match type is FileFilterMatchType.FILENAME, then the value of file.getPath() is compared to the regular expression. If the match type is FileFilterMatchType.PATH, then the value of file.getName() is compared to the regular expression.
        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.