org.apache.commons.io.filefilter

## Class PathVisitorFileFilter

- java.lang.Object
- - org.apache.commons.io.filefilter.AbstractFileFilter
  - - org.apache.commons.io.filefilter.PathVisitorFileFilter

- All Implemented Interfaces:
    FileFilter, FilenameFilter, FileVisitor<Path>, PathFilter, PathVisitor, IOFileFilter

      public class PathVisitorFileFilter
      extends AbstractFileFilter

  A file filter backed by a path visitor.
  Since:
    2.9.0

- - ### Field Summary

    - ### Fields inherited from interface org.apache.commons.io.filefilter.IOFileFilter

      `EMPTY_STRING_ARRAY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PathVisitorFileFilter(PathVisitor pathVisitor)` Constructs a new instance that will forward calls to the given visitor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `accept(File file)` Checks to see if the File should be accepted by this filter.
    `boolean` | `accept(File dir, String name)` Checks to see if the File should be accepted by this filter.
    `FileVisitResult` | `accept(Path path, BasicFileAttributes attributes)` Checks to see if the Path should be accepted by this filter.
    `FileVisitResult` | `visitFile(Path path, BasicFileAttributes attributes)`

    - ### Methods inherited from class org.apache.commons.io.filefilter.AbstractFileFilter

      `handle, postVisitDirectory, preVisitDirectory, toString, visitFileFailed`

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

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

    - ### Methods inherited from interface org.apache.commons.io.filefilter.IOFileFilter

      `and, negate, or`

- - ### Constructor Detail

    - #### PathVisitorFileFilter

          public PathVisitorFileFilter(PathVisitor pathVisitor)

      Constructs a new instance that will forward calls to the given visitor.
      Parameters:
        `pathVisitor` - visit me.

  - ### Method Detail

    - #### accept

          public boolean accept(File file)

      Description copied from class: `AbstractFileFilter`
      Checks to see if the File should be accepted by this filter.
      Specified by:
        `accept` in interface `FileFilter`
      Specified by:
        `accept` in interface `IOFileFilter`
      Overrides:
        `accept` in class `AbstractFileFilter`
      Parameters:
        `file` - the File to check
      Returns:
        true if this file matches the test

    - #### accept

          public boolean accept(File dir,
                                String name)

      Description copied from class: `AbstractFileFilter`
      Checks to see if the File should be accepted by this filter.
      Specified by:
        `accept` in interface `FilenameFilter`
      Specified by:
        `accept` in interface `IOFileFilter`
      Overrides:
        `accept` in class `AbstractFileFilter`
      Parameters:
        `dir` - the directory File to check
        `name` - the file name within the directory to check
      Returns:
        true if this file matches the test

    - #### accept

          public FileVisitResult accept(Path path,
                                        BasicFileAttributes attributes)

      Description copied from interface: `IOFileFilter`
      Checks to see if the Path should be accepted by this filter.
      Parameters:
        `path` - the Path to check.
        `attributes` - the file's basic attributes (TODO may be null).
      Returns:
        true if this path matches the test.

    - #### visitFile

          public FileVisitResult visitFile(Path path,
                                           BasicFileAttributes attributes)
                                    throws IOException

      Specified by:
        `visitFile` in interface `FileVisitor<Path>`
      Overrides:
        `visitFile` in class `AbstractFileFilter`
      Throws:
        `IOException`

Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.