com.google.common.io

## Class PatternFilenameFilter

- java.lang.Object
- - com.google.common.io.PatternFilenameFilter

- All Implemented Interfaces:
    java.io.FilenameFilter

      @Beta
      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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PatternFilenameFilter(java.util.regex.Pattern pattern)` Constructs a pattern file name filter object.
    `PatternFilenameFilter(java.lang.String patternStr)` Constructs a pattern file name filter object.

  - ### Method Summary

    Methods
    Modifier and Type | Method and 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(@Nullable
                       java.io.File dir,
                       java.lang.String fileName)

      Specified by:
        `accept` in interface `java.io.FilenameFilter`