public class NameFileFilter extends Object implements FileFilter, Serializable
For example, to print all files and directories in the current directory
whose name is Test:
FileSystemManager fsManager = VFS.getManager();
FileObject dir = fsManager.toFileObject(new File("."));
FileObject[] files = dir.findFiles(new FileFilterSelector(new NameFileFilter("Test")));
for (int i = 0; i < files.length; i++) {
System.out.println(files[i]);
}
| Constructor and Description |
|---|
NameFileFilter(IOCase caseSensitivity,
List<String> names)
Constructs a new name file filter for a list of names specifying
case-sensitivity.
|
NameFileFilter(IOCase caseSensitivity,
String... names)
Constructs a new name file filter for an array of names specifying
case-sensitivity.
|
NameFileFilter(List<String> names)
Constructs a new case-sensitive name file filter for a list of names.
|
NameFileFilter(String... names)
Constructs a new case-sensitive name file filter for an array of names.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(FileSelectInfo fileSelectInfo)
Checks to see if the file name matches.
|
String |
toString()
Provide a String representation of this file filter.
|
public NameFileFilter(List<String> names)
names - the names to allow, must not be nullpublic NameFileFilter(IOCase caseSensitivity, List<String> names)
caseSensitivity - how to handle case sensitivity, null means
case-sensitivenames - the names to allow, must not be nullpublic NameFileFilter(String... names)
The array is not cloned, so could be changed after constructing the instance. This would be inadvisable however.
names - the names to allow, must not be nullpublic boolean accept(FileSelectInfo fileSelectInfo)
accept in interface FileFilterfileSelectInfo - the File to checkCopyright © 2002–2020 The Apache Software Foundation. All rights reserved.