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| Modifier | Constructor and Description |
|---|---|
|
AbstractFileFilter()
Constructs a new instance.
|
protected |
AbstractFileFilter(FileVisitResult onAccept,
FileVisitResult onReject)
Constructs a new instance.
|
| 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, waitaccept, and, negate, orpublic AbstractFileFilter()
protected AbstractFileFilter(FileVisitResult onAccept, FileVisitResult onReject)
onAccept - What to do on acceptance.onReject - What to do on rejection.public boolean accept(File file)
accept in interface FileFilteraccept in interface IOFileFilterfile - the File to checkpublic boolean accept(File dir, String name)
accept in interface FilenameFilteraccept in interface IOFileFilterdir - 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>IOExceptionpublic FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attributes) throws IOException
preVisitDirectory in interface FileVisitor<Path>IOExceptionpublic FileVisitResult visitFile(Path file, BasicFileAttributes attributes) throws IOException
visitFile in interface FileVisitor<Path>IOExceptionpublic FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException
visitFileFailed in interface FileVisitor<Path>IOExceptionCopyright © 2002–2023 The Apache Software Foundation. All rights reserved.