org.apache.hadoop.fs

## Class GlobFilter

- java.lang.Object
- - org.apache.hadoop.fs.GlobFilter

- All Implemented Interfaces:
    PathFilter

      @InterfaceAudience.Public
       @InterfaceStability.Evolving
      public class GlobFilter
      extends Object
      implements PathFilter

  A filter for POSIX glob pattern with brace expansions.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GlobFilter(String filePattern)` Creates a glob filter with the specified file pattern.
    `GlobFilter(String filePattern, PathFilter filter)` Creates a glob filter with the specified file pattern and an user filter.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `accept(Path path)` Tests whether or not the specified abstract pathname should be included in a pathname list.
    `boolean` | `hasPattern()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GlobFilter

          public GlobFilter(String filePattern)
                     throws IOException

      Creates a glob filter with the specified file pattern.
      Parameters:
        `filePattern` - the file pattern.
      Throws:
        `IOException` - thrown if the file pattern is incorrect.

    - #### GlobFilter

          public GlobFilter(String filePattern,
                            PathFilter filter)
                     throws IOException

      Creates a glob filter with the specified file pattern and an user filter.
      Parameters:
        `filePattern` - the file pattern.
        `filter` - user filter in addition to the glob pattern.
      Throws:
        `IOException` - thrown if the file pattern is incorrect.

  - ### Method Detail

    - #### hasPattern

          public boolean hasPattern()

    - #### accept

          public boolean accept(Path path)

      Description copied from interface: `PathFilter`
      Tests whether or not the specified abstract pathname should be included in a pathname list.
      Specified by:
        `accept` in interface `PathFilter`
      Parameters:
        `path` - The abstract pathname to be tested
      Returns:
        `true` if and only if `pathname` should be included

Copyright © 2022 Apache Software Foundation. All rights reserved.