|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.net.ftp.FTPFileListParserImpl
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.
Field Summary | |
---|---|
protected org.apache.oro.text.regex.PatternMatcher |
_matcher_
Internal PatternMatcher object used by the parser. |
private org.apache.oro.text.regex.Pattern |
pattern
internal pattern the matcher tries to match, representing a file entry |
private org.apache.oro.text.regex.MatchResult |
result
internal match result used by the parser |
Constructor Summary | |
---|---|
FTPFileListParserImpl(java.lang.String regex)
The constructor for a MatchApparatus object. |
Method Summary | |
---|---|
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. |
FTPFile[] |
parseFileList(java.io.InputStream listStream)
Parses an FTP server file listing and converts it into a usable format in the form of an array of FTPFile instances. |
java.lang.String |
readNextEntry(java.io.BufferedReader reader)
Reads the next entry using the supplied BufferedReader object up to whatever delemits one entry from the next. |
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 |
Field Detail |
private org.apache.oro.text.regex.Pattern pattern
private org.apache.oro.text.regex.MatchResult result
protected org.apache.oro.text.regex.PatternMatcher _matcher_
Constructor Detail |
public FTPFileListParserImpl(java.lang.String regex)
regex
- The regular expression with which this object is
initialized.
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 |
public FTPFile[] parseFileList(java.io.InputStream listStream) throws java.io.IOException
FTPFile
instances. If the
file list contains no files, null
should be
returned, otherwise an array of FTPFile
instances
representing the files in the directory is returned.
parseFileList
in interface FTPFileListParser
listStream
- The InputStream from which the file list should be
read.
java.io.IOException
- If an I/O error occurs reading the listStream.public boolean matches(java.lang.String s)
s
- the String to be matched
public int getGroupCnt()
public java.lang.String group(int matchnum)
matchnum
- match group number to be retrieved
matchnum'th group of the internal
match or null if this method is called without a match having
been made.
public java.lang.String getGroupsAsString()
public java.lang.String readNextEntry(java.io.BufferedReader reader) throws java.io.IOException
readNextEntry
in interface FTPFileEntryParser
reader
- The BufferedReader object from which entries are to be
read.
java.io.IOException
- thrown on any IO Error reading from the reader.
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |