public abstract class RegexFTPFileEntryParserImpl extends FTPFileEntryParserImpl
This is the base class for all regular expression based FTPFileEntryParser classes
| Modifier and Type | Field and Description |
|---|---|
protected Matcher |
_matcher_
Internal PatternMatcher object used by the parser.
|
| Constructor and Description |
|---|
RegexFTPFileEntryParserImpl(String regex)
The constructor for a RegexFTPFileEntryParserImpl object.
|
RegexFTPFileEntryParserImpl(String regex,
int flags)
The constructor for a RegexFTPFileEntryParserImpl object.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getGroupCnt()
Convenience method
|
String |
getGroupsAsString()
Gets a string shows each match group by number.
|
String |
group(int matchNum)
Convenience method delegates to the internal MatchResult's group() method.
|
boolean |
matches(String s)
Convenience method delegates to the internal MatchResult's matches() method.
|
boolean |
setRegex(String regex)
Sets the regular expression for entry parsing and create a new
Pattern instance. |
boolean |
setRegex(String regex,
int flags)
Sets the regular expression for entry parsing and create a new
Pattern instance. |
preParse, readNextEntryclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitparseFTPEntryprotected Matcher _matcher_
public RegexFTPFileEntryParserImpl(String regex)
regex - The regular expression with which this object is initialized.IllegalArgumentException - Thrown if the regular expression is unparseable. Should not be seen in normal conditions. If it is seen, this is a sign
that a subclass has been created with a bad regular expression. Since the parser must be created before use, this means
that any bad parser subclasses created from this will bomb very quickly, leading to easy detection.public RegexFTPFileEntryParserImpl(String regex, int flags)
regex - The regular expression with which this object is initialized.flags - the flags to apply, see Pattern.compile(String, int). Use 0 for none.IllegalArgumentException - Thrown if the regular expression is unparseable. Should not be seen in normal conditions. If it is seen, this is a sign
that a subclass has been created with a bad regular expression. Since the parser must be created before use, this means
that any bad parser subclasses created from this will bomb very quickly, leading to easy detection.public int getGroupCnt()
public String getGroupsAsString()
For debugging purposes.
public String group(int matchNum)
matchNum - match group number to be retrievedmatchnum'th group of the internal match or null if this method is called without a match having been made.public boolean matches(String s)
s - the String to be matchedpublic boolean setRegex(String regex)
Pattern instance.regex - The new regular expressionIllegalArgumentException - if the regex cannot be compiledpublic boolean setRegex(String regex, int flags)
Pattern instance.regex - The new regular expressionflags - the flags to apply, see Pattern.compile(String, int). Use 0 for none.IllegalArgumentException - if the regex cannot be compiled