public abstract class AbstractFileFilter extends Object implements IOFileFilter, PathVisitor
FileFilter
(IO), FilenameFilter
(IO), PathFilter
(NIO)
interfaces via our own IOFileFilter
interface.
Note that a subclass MUST override one of the accept
methods, otherwise that subclass will infinitely loop.
EMPTY_STRING_ARRAY
Constructor and Description |
---|
AbstractFileFilter() |
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.
|
protected FileVisitResult |
handle(Throwable t)
Handles exceptions caught while accepting.
|
FileVisitResult |
postVisitDirectory(Path dir,
IOException exc) |
FileVisitResult |
preVisitDirectory(Path dir,
BasicFileAttributes attributes) |
String |
toString()
Provides a String representation of this file filter.
|
FileVisitResult |
visitFile(Path file,
BasicFileAttributes attributes) |
FileVisitResult |
visitFileFailed(Path file,
IOException exc) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
accept, and, negate, or
public boolean accept(File file)
accept
in interface FileFilter
accept
in interface IOFileFilter
file
- the File to checkpublic boolean accept(File dir, String name)
accept
in interface FilenameFilter
accept
in interface IOFileFilter
dir
- the directory File to checkname
- the file name within the directory to checkprotected FileVisitResult handle(Throwable t)
t
- the caught Throwable.public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException
postVisitDirectory
in interface FileVisitor<Path>
IOException
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attributes) throws IOException
preVisitDirectory
in interface FileVisitor<Path>
IOException
public String toString()
public FileVisitResult visitFile(Path file, BasicFileAttributes attributes) throws IOException
visitFile
in interface FileVisitor<Path>
IOException
public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException
visitFileFailed
in interface FileVisitor<Path>
IOException
Copyright © 2002–2021 The Apache Software Foundation. All rights reserved.