org.eclipse.jgit.fnmatch

## Class FileNameMatcher

- java.lang.Object
- - org.eclipse.jgit.fnmatch.FileNameMatcher

    public class FileNameMatcher
    extends Object

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:]
  e. g. [[:xdigit:]]

Any character can be escaped by prepending it with a \

### Constructor Summary

Constructors
Constructor and Description
`FileNameMatcher(FileNameMatcher other)` A Copy Constructor which creates a new `FileNameMatcher` with the same state and reset point like `other`.
`FileNameMatcher(String patternString, Character invalidWildgetCharacter)`

### Method Summary

Methods
`void` `append(String stringToMatch)`
`boolean` `canAppendMatch()`
`FileNameMatcher` `createMatcherForSuffix()`
`boolean` `isMatch()`
`void` `reset()` Resets this matcher to it's state right after construction.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### FileNameMatcher

    public FileNameMatcher(String patternString,
                   Character invalidWildgetCharacter)
                    throws InvalidPatternException

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

    public FileNameMatcher(FileNameMatcher other)

A Copy Constructor which creates a new `FileNameMatcher` with the same state and reset point like `other`.

Parameters:
  `other` - another `FileNameMatcher` instance.

### Method Detail

#### append

    public void append(String stringToMatch)

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

    public FileNameMatcher createMatcherForSuffix()

Returns:
  a `FileNameMatcher` instance 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()

Returns:
  true, if the string currently being matched does match.

#### canAppendMatch

    public boolean canAppendMatch()

Returns:
  false, if the string being matched will not match when the string gets extended.