public abstract class AbstractFileFilter extends java.lang.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.
| Modifier and Type | Field and Description |
|---|---|
private java.nio.file.FileVisitResult |
onAccept
What to do when this filter accepts.
|
private java.nio.file.FileVisitResult |
onReject
What to do when this filter rejects.
|
EMPTY_STRING_ARRAY| Modifier | Constructor and Description |
|---|---|
|
AbstractFileFilter()
Constructs a new instance.
|
protected |
AbstractFileFilter(java.nio.file.FileVisitResult onAccept,
java.nio.file.FileVisitResult onReject)
Constructs a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(java.io.File file)
Checks to see if the File should be accepted by this filter.
|
boolean |
accept(java.io.File dir,
java.lang.String name)
Checks to see if the File should be accepted by this filter.
|
(package private) void |
append(java.util.List<?> list,
java.lang.StringBuilder buffer) |
(package private) void |
append(java.lang.Object[] array,
java.lang.StringBuilder buffer) |
(package private) java.nio.file.FileVisitResult |
get(IOSupplier<java.nio.file.FileVisitResult> supplier) |
protected java.nio.file.FileVisitResult |
handle(java.lang.Throwable t)
Handles exceptions caught while accepting.
|
java.nio.file.FileVisitResult |
postVisitDirectory(java.nio.file.Path dir,
java.io.IOException exc) |
java.nio.file.FileVisitResult |
preVisitDirectory(java.nio.file.Path dir,
java.nio.file.attribute.BasicFileAttributes attributes) |
(package private) static java.nio.file.FileVisitResult |
toDefaultFileVisitResult(boolean accept) |
(package private) java.nio.file.FileVisitResult |
toFileVisitResult(boolean accept)
Converts a boolean into a FileVisitResult.
|
java.lang.String |
toString()
Provides a String representation of this file filter.
|
java.nio.file.FileVisitResult |
visitFile(java.nio.file.Path file,
java.nio.file.attribute.BasicFileAttributes attributes) |
java.nio.file.FileVisitResult |
visitFileFailed(java.nio.file.Path file,
java.io.IOException exc) |
private final java.nio.file.FileVisitResult onAccept
private final java.nio.file.FileVisitResult onReject
public AbstractFileFilter()
protected AbstractFileFilter(java.nio.file.FileVisitResult onAccept,
java.nio.file.FileVisitResult onReject)
onAccept - What to do on acceptance.onReject - What to do on rejection.static java.nio.file.FileVisitResult toDefaultFileVisitResult(boolean accept)
public boolean accept(java.io.File file)
accept in interface java.io.FileFilteraccept in interface IOFileFilterfile - the File to checkpublic boolean accept(java.io.File dir,
java.lang.String name)
accept in interface java.io.FilenameFilteraccept in interface IOFileFilterdir - the directory File to checkname - the file name within the directory to checkvoid append(java.util.List<?> list,
java.lang.StringBuilder buffer)
void append(java.lang.Object[] array,
java.lang.StringBuilder buffer)
java.nio.file.FileVisitResult get(IOSupplier<java.nio.file.FileVisitResult> supplier)
protected java.nio.file.FileVisitResult handle(java.lang.Throwable t)
t - the caught Throwable.public java.nio.file.FileVisitResult postVisitDirectory(java.nio.file.Path dir,
java.io.IOException exc)
throws java.io.IOException
postVisitDirectory in interface java.nio.file.FileVisitor<java.nio.file.Path>java.io.IOExceptionpublic java.nio.file.FileVisitResult preVisitDirectory(java.nio.file.Path dir,
java.nio.file.attribute.BasicFileAttributes attributes)
throws java.io.IOException
preVisitDirectory in interface java.nio.file.FileVisitor<java.nio.file.Path>java.io.IOExceptionjava.nio.file.FileVisitResult toFileVisitResult(boolean accept)
accept - accepted or rejected.public java.lang.String toString()
toString in class java.lang.Objectpublic java.nio.file.FileVisitResult visitFile(java.nio.file.Path file,
java.nio.file.attribute.BasicFileAttributes attributes)
throws java.io.IOException
visitFile in interface java.nio.file.FileVisitor<java.nio.file.Path>java.io.IOExceptionpublic java.nio.file.FileVisitResult visitFileFailed(java.nio.file.Path file,
java.io.IOException exc)
throws java.io.IOException
visitFileFailed in interface java.nio.file.FileVisitor<java.nio.file.Path>java.io.IOException