Class WildcardOSFilter
- java.lang.Object
-
- org.apache.commons.io.filefilter.AbstractFileFilter
-
- gov.nasa.pds.citool.file.filefilter.WildcardOSFilter
-
- All Implemented Interfaces:
FileFilter,FilenameFilter,org.apache.commons.io.filefilter.IOFileFilter
public class WildcardOSFilter extends org.apache.commons.io.filefilter.AbstractFileFilterFilters files using supplied wildcard(s). Based on the Apache WildcardFilter class in the Commons IO package. Difference is that in this class, it uses the org.apache.commons.io.FilenameUtils.wildcardMatchOnSystem() for its matching rules, which means that pattern matching using this class is OS dependent (case-insensitive on Windows and case-sensitive on Unix, Linux, MAC)- Version:
- $Revision: 5853 $
- Author:
- mcayanan
-
-
Constructor Summary
Constructors Constructor Description WildcardOSFilter(String wc)Constructor for a single wildcardWildcardOSFilter(List wc)Constructor for a list of wildcards
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccept(File file)Checks to see if the filename matches one of the wildcards.booleanaccept(File dir, String name)Checks to see if the filename matches one of the wildcards.ListgetWildcards()Returns list of filters that were set
-
-
-
Constructor Detail
-
WildcardOSFilter
public WildcardOSFilter(String wc)
Constructor for a single wildcard- Parameters:
wc- a single filter to set- Throws:
NullPointerException- if the pattern is null
-
WildcardOSFilter
public WildcardOSFilter(List wc)
Constructor for a list of wildcards- Parameters:
wc- a list of filters to set- Throws:
NullPointerException- if the pattern list is null
-
-
Method Detail
-
getWildcards
public List getWildcards()
Returns list of filters that were set- Returns:
- a list of filters
-
accept
public boolean accept(File file)
Checks to see if the filename matches one of the wildcards. Matching is case-insensitive for Windows and case-sensitive for Unix.- Specified by:
acceptin interfaceFileFilter- Specified by:
acceptin interfaceorg.apache.commons.io.filefilter.IOFileFilter- Overrides:
acceptin classorg.apache.commons.io.filefilter.AbstractFileFilter- Parameters:
file- the file to check- Returns:
- true if the filename matches one of the wildcards
- Throws:
NullPointerException- if the file is null
-
accept
public boolean accept(File dir, String name)
Checks to see if the filename matches one of the wildcards. Matching is case-insensitive for Windows and case-sensitive for Unix.- Specified by:
acceptin interfaceFilenameFilter- Specified by:
acceptin interfaceorg.apache.commons.io.filefilter.IOFileFilter- Overrides:
acceptin classorg.apache.commons.io.filefilter.AbstractFileFilter- Parameters:
dir- the directory to checkname- the file name within the directory to check- Returns:
- true if the filename matches one of the wildcards, false otherwise
- Throws:
NullPointerException- if the file is null
-
-