Package adalid.util.io
Class FileNameRegexFilter
java.lang.Object
javax.swing.filechooser.FileFilter
adalid.util.io.FileNameRegexFilter
- Author:
- Jorge Campins
-
Constructor Summary
ConstructorsConstructorDescriptionFileNameRegexFilter(String description, String regex) Creates aFileNameRegexFilterwith the specified description and regular expression.FileNameRegexFilter(String description, String regex, boolean dirs) Creates aFileNameRegexFilterwith the specified description and regular expression. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTests the specified file, returning true if it is a directory and directories are to be accepted, or its name matches the regular expression of thisFileFilter.toString()
-
Constructor Details
-
FileNameRegexFilter
Creates aFileNameRegexFilterwith the specified description and regular expression. The returnedFileNameRegexFilterwill accept all directories and any file with a file name matchingregex.- Parameters:
description- textual description for the filter, may benullregex- the accepted file name regular expression- Throws:
IllegalArgumentException- if regex is nullPatternSyntaxException- if regex's syntax is invalid- See Also:
-
FileNameRegexFilter
Creates aFileNameRegexFilterwith the specified description and regular expression. The returnedFileNameRegexFilterwill accept all directories and any file with a file name matchingregex.- Parameters:
description- textual description for the filter, may benullregex- the accepted file name regular expressiondirs- true if directories are to be accepted- Throws:
IllegalArgumentException- if regex is nullPatternSyntaxException- if regex's syntax is invalid- See Also:
-
-
Method Details
-
accept
Tests the specified file, returning true if it is a directory and directories are to be accepted, or its name matches the regular expression of thisFileFilter.- Specified by:
acceptin classFileFilter- Parameters:
f- theFileto test- Returns:
- true if the file is to be accepted, false otherwise
-
getDescription
- Specified by:
getDescriptionin classFileFilter- Returns:
- the description of this filter
-
getPattern
- Returns:
- the regular expression files are tested against
-
toString
-