Package info.freelibrary.util
Class RegexFileFilter
- java.lang.Object
-
- info.freelibrary.util.RegexFileFilter
-
- All Implemented Interfaces:
FilenameFilter
public class RegexFileFilter extends Object implements FilenameFilter
AFilenameFilter
that allows filtering file names based on regular expressions.
-
-
Constructor Summary
Constructors Constructor Description RegexFileFilter(String aPattern)
Constructor for a regular expressionFilenameFilter
.RegexFileFilter(String aPattern, boolean aCaseInsensitivePattern)
Constructor for a regular expressionFilenameFilter
that creates a case insensitive.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(File aDir, String aFilename)
Determines whether the suppliedFile
in the supplied directory should be included.String
toString()
Returns a string version of the regular expression used as a filter.
-
-
-
Constructor Detail
-
RegexFileFilter
public RegexFileFilter(String aPattern)
Constructor for a regular expressionFilenameFilter
.- Parameters:
aPattern
- The regular expression for the filter
-
RegexFileFilter
public RegexFileFilter(String aPattern, boolean aCaseInsensitivePattern)
Constructor for a regular expressionFilenameFilter
that creates a case insensitive.- Parameters:
aPattern
- The regular expression for the filteraCaseInsensitivePattern
- A case insensitive regular expression pattern
-
-
Method Detail
-
accept
public boolean accept(File aDir, String aFilename)
Determines whether the suppliedFile
in the supplied directory should be included.- Specified by:
accept
in interfaceFilenameFilter
- Parameters:
aDir
- The directory in which theFile
of the file name livesaFilename
- AFile
name to compare against the regular expression; it must be a file (not a directory)
-
-