Class PatternFilenameFilter

  • All Implemented Interfaces:
    java.io.FilenameFilter

    @GwtIncompatible
    public final class PatternFilenameFilter
    extends java.lang.Object
    implements java.io.FilenameFilter
    File name filter that only accepts files matching a regular expression. This class is thread-safe and immutable.
    Since:
    1.0
    Author:
    Apple Chow
    • Constructor Summary

      Constructors 
      Constructor Description
      PatternFilenameFilter​(java.lang.String patternStr)
      Constructs a pattern file name filter object.
      PatternFilenameFilter​(java.util.regex.Pattern pattern)
      Constructs a pattern file name filter object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accept​(java.io.File dir, java.lang.String fileName)  
      • Methods inherited from class java.lang.Object

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

      • PatternFilenameFilter

        public PatternFilenameFilter​(java.lang.String patternStr)
        Constructs a pattern file name filter object.
        Parameters:
        patternStr - the pattern string on which to filter file names
        Throws:
        java.util.regex.PatternSyntaxException - if pattern compilation fails (runtime)
      • PatternFilenameFilter

        public PatternFilenameFilter​(java.util.regex.Pattern pattern)
        Constructs a pattern file name filter object.
        Parameters:
        pattern - the pattern on which to filter file names
    • Method Detail

      • accept

        public boolean accept​(java.io.File dir,
                              java.lang.String fileName)
        Specified by:
        accept in interface java.io.FilenameFilter