|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.clapper.util.io.MultipleRegexFilenameFilter
public class MultipleRegexFilenameFilter
MultipleRegexFilenameFilter implements a java.io.FilenameFilter that matches file names and path names using one or more regular expressions. A MultipleRegexFilenameFilter contains two sets of regular expressions, an accept set and a reject set. To be accepted, a file name must not match any of the patterns in the reject set, and it must match at least one of the patterns in the accept set. If the reject set is empty, then no explicit rejections are done. However, if the accept set is empty, then all files are assumed to be accepted. (i.e., It's as if the accept set contained a single "^.*$" pattern.)
A MultipleRegexFilenameFilter can be configured to operate on just the simple file name, or on the file's path.
MultipleRegexFilenameFilter uses the java.util.regex regular expression classes, so it requires JDK 1.4 or newer.
CombinationFilenameFilter,
CombinationFileFilter| Nested Class Summary | |
|---|---|
static class |
MultipleRegexFilenameFilter.MatchType
Match types |
| Constructor Summary | |
|---|---|
MultipleRegexFilenameFilter(MultipleRegexFilenameFilter.MatchType matchType)
Construct a new MultipleRegexFilenameFilter. |
|
| Method Summary | |
|---|---|
boolean |
accept(java.io.File dir,
java.lang.String name)
Determine whether a file is to be accepted or not, based on the regular expressions in the reject and accept lists. |
void |
addAcceptPattern(java.lang.String pattern)
Add an "accept" pattern to this filter. |
void |
addRejectPattern(java.lang.String pattern)
Add an "accept" pattern to this filter. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MultipleRegexFilenameFilter(MultipleRegexFilenameFilter.MatchType matchType)
matchType - MatchType.FILENAME to match just the
filename, MatchType.PATH to match the path| Method Detail |
|---|
public void addAcceptPattern(java.lang.String pattern)
throws java.util.regex.PatternSyntaxException
pattern - the regular expression to add
java.util.regex.PatternSyntaxException - bad regular expressionaddRejectPattern(java.lang.String)
public void addRejectPattern(java.lang.String pattern)
throws java.util.regex.PatternSyntaxException
pattern - the regular expression to add
java.util.regex.PatternSyntaxException - bad regular expressionaddAcceptPattern(java.lang.String)
public boolean accept(java.io.File dir,
java.lang.String name)
accept in interface java.io.FilenameFilterdir - The directory containing the file. Ignored if
the match type is MatchType.FILENAME. Used to
build the path to match when the match type is
MatchType.PATHname - the file name
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||