public class StartAndEndsWithFilter
extends java.lang.Object
implements java.io.FilenameFilter
Modifier and Type | Field and Description |
---|---|
(package private) boolean |
invert
do we return all directories but the ones in the list.
|
Constructor and Description |
---|
StartAndEndsWithFilter()
constructor.
|
StartAndEndsWithFilter(boolean invert)
constructor.
|
StartAndEndsWithFilter(boolean invert,
java.lang.String[] includeStartsWith,
java.lang.String[] includeEndsWith,
java.util.regex.Pattern[] includeRegexMatch,
java.lang.String[] excludeStartsWith,
java.lang.String[] excludeEndsWith,
java.util.regex.Pattern[] excludeRegexMatch)
constructor.
|
StartAndEndsWithFilter(java.lang.String[] includeStartsWith,
java.lang.String[] includeEndsWith,
java.util.regex.Pattern[] includeRegexMatch,
java.lang.String[] excludeStartsWith,
java.lang.String[] excludeEndsWith,
java.util.regex.Pattern[] excludeRegexMatch)
constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.io.File dir,
java.lang.String name)
Select only Files that pass the 4 include/exclude criteria
|
static void |
main(java.lang.String[] args) |
void |
setExcludeEndsWith(java.lang.String... excludeEndsWith)
set strings to exclude when filename ends with these strings.
|
void |
setExcludeRegexMatch(java.util.regex.Pattern... excludeRegexMatch)
set regex patterns to exclude when filename matches.
|
void |
setExcludeStartsWith(java.lang.String... excludeStartsWith)
set strings exclude when filename starts with them.
|
void |
setIncludeEndsWith(java.lang.String... includeEndsWith)
set strings include when filename ends with them.
|
void |
setIncludeRegexMatch(java.util.regex.Pattern... includeRegexMatch)
set regex patterns to include when filename matches.
|
void |
setIncludeStartsWith(java.lang.String... includeStartsWith)
set strings include when filename starts with them.
|
public StartAndEndsWithFilter()
public StartAndEndsWithFilter(boolean invert)
invert
- if true, selects files not in the list insteadpublic StartAndEndsWithFilter(java.lang.String[] includeStartsWith, java.lang.String[] includeEndsWith, java.util.regex.Pattern[] includeRegexMatch, java.lang.String[] excludeStartsWith, java.lang.String[] excludeEndsWith, java.util.regex.Pattern[] excludeRegexMatch)
includeStartsWith
- filename start strings, to include, case insensitive, e.g. new String[ "prod"];includeEndsWith
- filename end strings, to include, case insensitive, e.g. new String[".html", ".txt", .bat" ];includeRegexMatch
- filename regex matches to includeexcludeStartsWith
- filename start strings, to exclude, case insensitive, e.g. new String["_" ];excludeEndsWith
- filename end strings, to exclude, case insensitive, e.g. new String[".foot.html" ];excludeRegexMatch
- filename regex matches to excludepublic StartAndEndsWithFilter(boolean invert, java.lang.String[] includeStartsWith, java.lang.String[] includeEndsWith, java.util.regex.Pattern[] includeRegexMatch, java.lang.String[] excludeStartsWith, java.lang.String[] excludeEndsWith, java.util.regex.Pattern[] excludeRegexMatch)
includeStartsWith
- filename start strings, to include, case insensitive, e.g. new String[ "prod"];includeEndsWith
- filename end strings, to include, case insensitive, e.g. new String[".html", ".txt", .bat" ];includeRegexMatch
- filename regex matches to includeexcludeStartsWith
- filename start strings, to exclude, case insensitive, e.g. new String["_" ];excludeEndsWith
- filename end strings, to exclude, case insensitive, e.g. new String[".foot.html" ];excludeRegexMatch
- filename regex matches to excludepublic boolean accept(java.io.File dir, java.lang.String name)
accept
in interface java.io.FilenameFilter
dir
- the directory in which the file was found.name
- the name of the filepublic void setExcludeEndsWith(java.lang.String... excludeEndsWith)
excludeEndsWith
- end with stringspublic void setExcludeRegexMatch(java.util.regex.Pattern... excludeRegexMatch)
excludeRegexMatch
- end with stringspublic void setExcludeStartsWith(java.lang.String... excludeStartsWith)
excludeStartsWith
- end with stringspublic void setIncludeEndsWith(java.lang.String... includeEndsWith)
includeEndsWith
- end with stringspublic void setIncludeRegexMatch(java.util.regex.Pattern... includeRegexMatch)
includeRegexMatch
- end with stringspublic void setIncludeStartsWith(java.lang.String... includeStartsWith)
includeStartsWith
- end with stringspublic static void main(java.lang.String[] args)