java.lang.Object
org.eclipse.jgit.fnmatch.FileNameMatcher
This class can be used to match filenames against fnmatch like patterns. It
is not thread save.
Supported are the wildcard characters * and ? and groups with:
- characters e.g. [abc]
- ranges e.g. [a-z]
- the following character classes
- [:alnum:]
- [:alpha:]
- [:blank:]
- [:cntrl:]
- [:digit:]
- [:graph:]
- [:lower:]
- [:print:]
- [:punct:]
- [:space:]
- [:upper:]
- [:word:]
- [:xdigit:]
-
Constructor Summary
ConstructorsConstructorDescriptionFileNameMatcher(String patternString, Character invalidWildgetCharacter) Constructor for FileNameMatcherFileNameMatcher(FileNameMatcher other) A Copy Constructor which creates a newFileNameMatcherwith the same state and reset point likeother. -
Method Summary
Modifier and TypeMethodDescriptionvoidAppend to the string which is matched against the patterns of this classbooleanWhether a match can be appendedCreate aFileNameMatcherinstance which uses the same pattern like this matcher, but has the current state of this matcher as reset and start pointbooleanisMatch()Whether the matcher matchesvoidreset()Resets this matcher to it's state right after construction.
-
Constructor Details
-
FileNameMatcher
public FileNameMatcher(String patternString, Character invalidWildgetCharacter) throws InvalidPatternException Constructor for FileNameMatcher- Parameters:
patternString- must contain a pattern which fnmatch would accept.invalidWildgetCharacter- if this parameter isn't null then this character will not match at wildcards(* and ? are wildcards).- Throws:
InvalidPatternException- if the patternString contains a invalid fnmatch pattern.
-
FileNameMatcher
A Copy Constructor which creates a newFileNameMatcherwith the same state and reset point likeother.- Parameters:
other- anotherFileNameMatcherinstance.
-
-
Method Details
-
append
Append to the string which is matched against the patterns of this class- Parameters:
stringToMatch- extends the string which is matched against the patterns of this class.
-
reset
public void reset()Resets this matcher to it's state right after construction. -
createMatcherForSuffix
Create aFileNameMatcherinstance which uses the same pattern like this matcher, but has the current state of this matcher as reset and start point- Returns:
- a
FileNameMatcherinstance which uses the same pattern like this matcher, but has the current state of this matcher as reset and start point.
-
isMatch
public boolean isMatch()Whether the matcher matches- Returns:
- whether the matcher matches
-
canAppendMatch
public boolean canAppendMatch()Whether a match can be appended- Returns:
- a boolean.
-