org.apache.commons.io.filefilter

Class OrFileFilter

Implemented Interfaces:
FileFilter, FilenameFilter, IOFileFilter

public class OrFileFilter
extends AbstractFileFilter

This filter produces a logical OR of the two filters specified.
Version:
$Revision: 1.8 $ $Date: 2004/02/23 04:37:57 $
Author:
Stephen Colebourne
Since:
Commons IO 1.0

Field Summary

private IOFileFilter
filter1
The first filter
private IOFileFilter
filter2
The second filter

Constructor Summary

OrFileFilter(IOFileFilter filter1, IOFileFilter filter2)
Constructs a new file filter that ORs the result of two other filters.

Method Summary

boolean
accept(File file)
Checks to see if either filter is true.
boolean
accept(File file, String name)
Checks to see if either filter is true.

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

accept, accept

Field Details

filter1

private IOFileFilter filter1
The first filter

filter2

private IOFileFilter filter2
The second filter

Constructor Details

OrFileFilter

public OrFileFilter(IOFileFilter filter1,
                    IOFileFilter filter2)
Constructs a new file filter that ORs the result of two other filters.
Parameters:
filter1 - the first filter, must not be null
filter2 - the second filter, must not be null

Method Details

accept

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

accept

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