Class GlobFilter

java.lang.Object
org.apache.hadoop.fs.GlobFilter
All Implemented Interfaces:
PathFilter

@Public @Evolving public class GlobFilter extends Object implements PathFilter
A filter for POSIX glob pattern with brace expansions.
  • Constructor Details

    • 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 Details

    • 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