@Deprecated public abstract class StrMatcher extends Object
This class comes complete with various factory methods. If these do not suffice, you can subclass and implement your own matcher.
| Modifier | Constructor and Description |
|---|---|
protected |
StrMatcher()
Deprecated.
Constructs a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
static StrMatcher |
charMatcher(char ch)
Deprecated.
Creates a matcher from a character.
|
static StrMatcher |
charSetMatcher(char... chars)
Deprecated.
Creates a matcher from a set of characters.
|
static StrMatcher |
charSetMatcher(String chars)
Deprecated.
Creates a matcher from a string representing a set of characters.
|
static StrMatcher |
commaMatcher()
Deprecated.
Gets the matcher for the comma character.
|
static StrMatcher |
doubleQuoteMatcher()
Deprecated.
Gets the matcher for the double quote character.
|
int |
isMatch(char[] buffer,
int pos)
Deprecated.
Tests whether the number of matching characters, zero for no match.
|
abstract int |
isMatch(char[] buffer,
int pos,
int bufferStart,
int bufferEnd)
Deprecated.
Tests whether the number of matching characters, zero for no match.
|
static StrMatcher |
noneMatcher()
Deprecated.
Gets the matcher for no characters.
|
static StrMatcher |
quoteMatcher()
Deprecated.
Gets the matcher for the single or double quote character.
|
static StrMatcher |
singleQuoteMatcher()
Deprecated.
Gets the matcher for the single quote character.
|
static StrMatcher |
spaceMatcher()
Deprecated.
Gets the matcher for the space character.
|
static StrMatcher |
splitMatcher()
Deprecated.
Gets the matcher for the same characters as StringTokenizer,
namely space, tab, newline and form-feed.
|
static StrMatcher |
stringMatcher(String str)
Deprecated.
Creates a matcher for a string.
|
static StrMatcher |
tabMatcher()
Deprecated.
Gets the matcher for the tab character.
|
static StrMatcher |
trimMatcher()
Deprecated.
Gets the matcher to String trim() whitespace characters.
|
public static StrMatcher charMatcher(char ch)
ch - the character to match, must not be nullpublic static StrMatcher charSetMatcher(char... chars)
chars - the characters to match, null or empty matches nothingpublic static StrMatcher charSetMatcher(String chars)
chars - the characters to match, null or empty matches nothingpublic static StrMatcher commaMatcher()
public static StrMatcher doubleQuoteMatcher()
public static StrMatcher noneMatcher()
public static StrMatcher quoteMatcher()
public static StrMatcher singleQuoteMatcher()
public static StrMatcher spaceMatcher()
public static StrMatcher splitMatcher()
public static StrMatcher stringMatcher(String str)
str - the string to match, null or empty matches nothingpublic static StrMatcher tabMatcher()
public static StrMatcher trimMatcher()
public int isMatch(char[] buffer,
int pos)
This method is called to check for a match.
The parameter pos represents the current position to be
checked in the string buffer (a character array which must
not be changed).
The API guarantees that pos is a valid index for buffer.
The matching code may check one character or many.
It may check characters preceding pos as well as those after.
It must return zero for no match, or a positive number if a match was found. The number indicates the number of characters that matched.
buffer - the text content to match against, do not changepos - the starting position for the match, valid for bufferpublic abstract int isMatch(char[] buffer,
int pos,
int bufferStart,
int bufferEnd)
This method is called to check for a match.
The parameter pos represents the current position to be
checked in the string buffer (a character array which must
not be changed).
The API guarantees that pos is a valid index for buffer.
The character array may be larger than the active area to be matched. Only values in the buffer between the specified indices may be accessed.
The matching code may check one character or many.
It may check characters preceding pos as well as those
after, so long as no checks exceed the bounds specified.
It must return zero for no match, or a positive number if a match was found. The number indicates the number of characters that matched.
buffer - the text content to match against, do not changepos - the starting position for the match, valid for bufferbufferStart - the first active index in the buffer, valid for bufferbufferEnd - the end index (exclusive) of the active buffer, valid for bufferCopyright © 2001–2025 The Apache Software Foundation. All rights reserved.