java.io

Interface FileFilter

Known Subinterfaces:
IOFileFilter
Known Implementing Classes:
AbstractFileFilter, AgeFileFilter, AndFileFilter, AwkFilenameFilter, CanReadFileFilter, CanWriteFileFilter, DelegateFileFilter, DirectoryFileFilter, EmptyFileFilter, FalseFileFilter, FileFileFilter, GlobFilenameFilter, HiddenFileFilter, JMeterFileFilter, NameFileFilter, NotFileFilter, OrFileFilter, Perl5FilenameFilter, PrefixFileFilter, RegexFileFilter, RegexFilenameFilter, SizeFileFilter, SuffixFileFilter, TrueFileFilter, WildcardFileFilter, WildcardFilter

public interface FileFilter

A filter for abstract pathnames.

Instances of this interface may be passed to the listFiles(FileFilter) method of the File class.

Since:
1.2

Method Summary

boolean
accept(File pathname)
Tests whether or not the specified abstract pathname should be included in a pathname list.

Method Details

accept

public boolean accept(File pathname)
Tests whether or not the specified abstract pathname should be included in a pathname list.
Parameters:
pathname - The abstract pathname to be tested
Returns:
true if and only if pathname should be included
Usages and Demos :

View More Examples of accept(File pathname)
   1: import java.io.File;
   2: import java.io.FileFilter;
   3: 
   4:         ...
   5: public final class NegativeFileFilter implements FileFilter {
   6: 
   7:         ...
   8:     private FileFilter primaryFilter;
   9: 
  10:         ...
  11:     public final boolean accept(final File file) {
  12:         return !primaryFilter.accept(file);

View Full Code Here
   1: package org.apache.commons.io.filefilter;
   2: 
   3:         ...
   4: import java.io.File;
   5: import java.io.FileFilter;
   6: import java.io.FilenameFilter;
   7:         ...
   8: 
   9:     private final FileFilter fileFilter;
  10: 
  11:         ...
  12:         if (fileFilter != null) {
  13:             return fileFilter.accept(file);

View Full Code Here
   1: import java.io.File;
   2: import java.io.FileFilter;
   3: 
   4:         ...
   5: 
   6:     public static FileFilter prefixFileFilter(final String prefix) {
   7:         final String _prefix = (prefix == null ? "" : prefix);
   8:         ...
   9:         return new FileFilter() {
  10:             public boolean accept(File pathname) {
  11:         ...
  12:                 for(int i = 0; i < filters.length; i++) {
  13:                     result = result && filters[i].accept(pathname);

View Full Code Here