org.apache.commons.io.filefilter

## Class FileEqualsFileFilter

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

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

      public class FileEqualsFileFilter
      extends AbstractFileFilter

  Accepts only an exact `File` object match. You can use this filter to visit the start directory when walking a file tree with `Files.walkFileTree(java.nio.file.Path, java.util.Set, int, java.nio.file.FileVisitor)`.
  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
    `FileEqualsFileFilter(File file)` Constructs a new instance for the given `File`.

  - ### 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.
    `FileVisitResult` | `accept(Path path, BasicFileAttributes attributes)` Checks to see if the Path should be accepted by this filter.

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

      `accept, handle, postVisitDirectory, preVisitDirectory, toString, visitFile, 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

    - #### FileEqualsFileFilter

          public FileEqualsFileFilter(File file)

      Constructs a new instance for the given `File`.
      Parameters:
        `file` - The file to match.

  - ### 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 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.

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