Package org.apache.commons.vfs2.filter
Class NameFileFilter
java.lang.Object
org.apache.commons.vfs2.filter.NameFileFilter
- All Implemented Interfaces:
- Serializable,- FileFilter
Filters file names for a certain name.
 
 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]);
 }
 - Since:
- 2.4
- Author:
- This code was originally ported from Apache Commons IO File Filter
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionNameFileFilter(String... names) Constructs a new case-sensitive name file filter for an array of names.NameFileFilter(List<String> names) Constructs a new case-sensitive name file filter for a list of names.NameFileFilter(IOCase caseSensitivity, String... names) Constructs a new name file filter for an array of names specifying case-sensitivity.NameFileFilter(IOCase caseSensitivity, List<String> names) Constructs a new name file filter for a list of names specifying case-sensitivity.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanaccept(FileSelectInfo fileSelectInfo) Checks to see if the file name matches.toString()Provide a String representation of this file filter.
- 
Constructor Details- 
NameFileFilterConstructs a new name file filter for a list of names specifying case-sensitivity.- Parameters:
- caseSensitivity- how to handle case sensitivity, null means case-sensitive
- names- the names to allow, must not be null
 
- 
NameFileFilterConstructs a new name file filter for an array of names specifying case-sensitivity.- Parameters:
- caseSensitivity- how to handle case sensitivity, null means case-sensitive
- names- the names to allow, must not be null
 
- 
NameFileFilterConstructs a new case-sensitive name file filter for a list of names.- Parameters:
- names- the names to allow, must not be null
 
- 
NameFileFilterConstructs a new case-sensitive name file filter for an array of names.The array is not cloned, so could be changed after constructing the instance. This would be inadvisable however. - Parameters:
- names- the names to allow, must not be null
 
 
- 
- 
Method Details- 
acceptChecks to see if the file name matches.- Specified by:
- acceptin interface- FileFilter
- Parameters:
- fileSelectInfo- the File to check
- Returns:
- true if the file name matches
 
- 
toStringProvide a String representation of this file filter.
 
-