Package org.apache.commons.vfs2.filter
Class EmptyFileFilter
java.lang.Object
org.apache.commons.vfs2.filter.EmptyFileFilter
- All Implemented Interfaces:
- Serializable,- FileFilter
This filter accepts files or directories that are empty.
 
 If the File is a directory it checks that it contains no files.
 
Example, showing how to print out a list of the current directory's empty files/directories:
 FileSystemManager fsManager = VFS.getManager();
 FileObject dir = fsManager.toFileObject(new File("."));
 FileObject[] files = dir.findFiles(new FileFilterSelector(EmptyFileFilter.EMPTY));
 for (int i = 0; i < files.length; i++) {
     System.out.println(files[i]);
 }
 
 Example, showing how to print out a list of the current directory's non-empty files/directories:
 FileSystemManager fsManager = VFS.getManager();
 FileObject dir = fsManager.toFileObject(new File("."));
 FileObject[] files = dir.findFiles(new FileFilterSelector(EmptyFileFilter.NOT_EMPTY));
 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:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final FileFilterSingleton instance of empty filter.static final FileFilterSingleton instance of not-empty filter.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanaccept(FileSelectInfo fileSelectInfo) Checks to see if the file is empty.
- 
Field Details- 
EMPTYSingleton instance of empty filter.
- 
NOT_EMPTYSingleton instance of not-empty filter.
 
- 
- 
Constructor Details- 
EmptyFileFilterprotected EmptyFileFilter()Restrictive constructor.
 
- 
- 
Method Details- 
acceptChecks to see if the file is empty. A non-existing file is also considered empty.- Specified by:
- acceptin interface- FileFilter
- Parameters:
- fileSelectInfo- the file or directory to check
- Returns:
- trueif the file or directory is empty, otherwise- false.
- Throws:
- FileSystemException- Thrown for file system errors.
 
 
-