org.apache.commons.io.filefilter

Class DelegateFileFilter

Implemented Interfaces:
FileFilter, FilenameFilter, Serializable, IOFileFilter

public class DelegateFileFilter
extends AbstractFileFilter
implements Serializable

This class turns a Java FileFilter or FilenameFilter into an IO FileFilter.
Version:
$Revision: 591058 $ $Date: 2007-11-01 15:47:05 +0000 (Thu, 01 Nov 2007) $
Author:
Stephen Colebourne
Since:
Commons IO 1.0

Field Summary

private FileFilter
fileFilter
The File filter
private FilenameFilter
filenameFilter
The Filename filter

Constructor Summary

DelegateFileFilter(FileFilter filter)
Constructs a delegate file filter around an existing FileFilter.
DelegateFileFilter(FilenameFilter filter)
Constructs a delegate file filter around an existing FilenameFilter.

Method Summary

boolean
accept(File file)
Checks the filter.
boolean
accept(File dir, String name)
Checks the filter.
String
toString()
Provide a String representaion of this file filter.

Methods inherited from class org.apache.commons.io.filefilter.AbstractFileFilter

accept, accept, toString

Field Details

fileFilter

private final FileFilter fileFilter
The File filter

filenameFilter

private final FilenameFilter filenameFilter
The Filename filter

Constructor Details

DelegateFileFilter

public DelegateFileFilter(FileFilter filter)
Constructs a delegate file filter around an existing FileFilter.
Parameters:
filter - the filter to decorate

DelegateFileFilter

public DelegateFileFilter(FilenameFilter filter)
Constructs a delegate file filter around an existing FilenameFilter.
Parameters:
filter - the filter to decorate

Method Details

accept

public boolean accept(File file)
Checks the filter.
Specified by:
accept in interface IOFileFilter
Overrides:
accept in interface AbstractFileFilter
Parameters:
file - the file to check
Returns:
true if the filter matches

accept

public boolean accept(File dir,
                      String name)
Checks the filter.
Specified by:
accept in interface IOFileFilter
Overrides:
accept in interface AbstractFileFilter
Parameters:
dir - the directory
name - the filename in the directory
Returns:
true if the filter matches

toString

public String toString()
Provide a String representaion of this file filter.
Overrides:
toString in interface AbstractFileFilter
Returns:
a String representaion

Copyright (c) 2002-2009 Apache Software Foundation