public class SuffixFileFilter extends java.lang.Object implements FileFilter, java.io.Serializable
For example, to retrieve and print all *.java
files in the
current directory:
FileSystemManager fsManager = VFS.getManager(); FileObject dir = fsManager.toFileObject(new File(".")); FileObject[] files = dir.findFiles(new FileFilterSelector(new SuffixFileFilter(".java"))); for (int i = 0; i < files.length; i++) { System.out.println(files[i]); }
Modifier and Type | Field and Description |
---|---|
private IOCase |
caseSensitivity
Whether the comparison is case sensitive.
|
private static long |
serialVersionUID |
private java.util.List<java.lang.String> |
suffixes
The file name suffixes to search for.
|
Constructor and Description |
---|
SuffixFileFilter(IOCase caseSensitivity,
java.util.List<java.lang.String> suffixes)
Constructs a new Suffix file filter for a list of suffixes specifying
case-sensitivity.
|
SuffixFileFilter(IOCase caseSensitivity,
java.lang.String... suffixes)
Constructs a new Suffix file filter for an array of suffixs specifying
case-sensitivity.
|
SuffixFileFilter(java.util.List<java.lang.String> suffixes)
Constructs a new Suffix file filter for a list of suffixes.
|
SuffixFileFilter(java.lang.String... suffixes)
Constructs a new Suffix file filter for an array of suffixes.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(FileSelectInfo fileInfo)
Checks to see if the file name ends with the suffix.
|
java.lang.String |
toString()
Provides a String representation of this file filter.
|
private static final long serialVersionUID
private final IOCase caseSensitivity
private final java.util.List<java.lang.String> suffixes
public SuffixFileFilter(java.util.List<java.lang.String> suffixes)
suffixes
- the suffixes to allow, must not be nullpublic SuffixFileFilter(IOCase caseSensitivity, java.util.List<java.lang.String> suffixes)
suffixes
- the suffixes to allow, must not be nullcaseSensitivity
- how to handle case sensitivity, null means
case-sensitivepublic SuffixFileFilter(java.lang.String... suffixes)
suffixes
- the suffixes to allow, must not be nullpublic SuffixFileFilter(IOCase caseSensitivity, java.lang.String... suffixes)
suffixes
- the suffixes to allow, must not be nullcaseSensitivity
- how to handle case sensitivity, null means
case-sensitivepublic boolean accept(FileSelectInfo fileInfo)
accept
in interface FileFilter
fileInfo
- the File to checkpublic java.lang.String toString()
toString
in class java.lang.Object