|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindprod.filter.StartAndEndsWithFilter
public class StartAndEndsWithFilter
Filter based on startsWith/EndsWith Regex includes/excludes.
To be selected a file must start with one of the include start with strings or end with one of the include end with strings, and it must not start with any of the exclude start with strings or end with any of the exclude exclude end with strings. It need not have both an include start and end string to be included. It need not have both an include start and end string to be excluded. Rejects all directories.
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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 excludeMethod Detail |
---|
public 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 file
public 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)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |