Class RegexFTPFileEntryParserImpl
- java.lang.Object
-
- org.apache.commons.net.ftp.FTPFileEntryParserImpl
-
- org.apache.commons.net.ftp.parser.RegexFTPFileEntryParserImpl
-
- All Implemented Interfaces:
FTPFileEntryParser
,FTPFileListParser
- Direct Known Subclasses:
ConfigurableFTPFileEntryParserImpl
,EnterpriseUnixFTPEntryParser
,FTPFileListParserImpl
public abstract class RegexFTPFileEntryParserImpl extends FTPFileEntryParserImpl
This abstract class implements both the older FTPFileListParser and newer FTPFileEntryParser interfaces with default functionality. All the classes in the parser subpackage inherit from this. This is the base for all regular based FTPFileEntryParser- Author:
- Steve Cohen
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.oro.text.regex.PatternMatcher
_matcher_
Internal PatternMatcher object used by the parser.
-
Constructor Summary
Constructors Constructor Description RegexFTPFileEntryParserImpl(java.lang.String regex)
The constructor for a RegexFTPFileEntryParserImpl object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getGroupCnt()
Convenience method delegates to the internal MatchResult's groups() method.java.lang.String
getGroupsAsString()
For debugging purposes - returns a string shows each match group by number.java.lang.String
group(int matchnum)
Convenience method delegates to the internal MatchResult's group() method.boolean
matches(java.lang.String s)
Convenience method delegates to the internal MatchResult's matches() method.-
Methods inherited from class org.apache.commons.net.ftp.FTPFileEntryParserImpl
parseFileList, parseFileList, preParse, readNextEntry
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.net.ftp.FTPFileEntryParser
parseFTPEntry
-
-
-
-
Constructor Detail
-
RegexFTPFileEntryParserImpl
public RegexFTPFileEntryParserImpl(java.lang.String regex)
The constructor for a RegexFTPFileEntryParserImpl object.- Parameters:
regex
- The regular expression with which this object is initialized.- Throws:
java.lang.IllegalArgumentException
- Thrown if the regular expression is unparseable. Should not be seen in normal conditions. It 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.
-
-
Method Detail
-
matches
public boolean matches(java.lang.String s)
Convenience method delegates to the internal MatchResult's matches() method.- Parameters:
s
- the String to be matched- Returns:
- true if s matches this object's regular expression.
-
getGroupCnt
public int getGroupCnt()
Convenience method delegates to the internal MatchResult's groups() method.- Returns:
- the number of groups() in the internal MatchResult.
-
group
public java.lang.String group(int matchnum)
Convenience method delegates to the internal MatchResult's group() method.- Parameters:
matchnum
- match group number to be retrieved- Returns:
- the content of the
matchnum'th
group of the internal match or null if this method is called without a match having been made.
-
getGroupsAsString
public java.lang.String getGroupsAsString()
For debugging purposes - returns a string shows each match group by number.- Returns:
- a string shows each match group by number.
-
-