Class ConfigurableFTPFileEntryParserImpl
java.lang.Object
org.apache.commons.net.ftp.FTPFileEntryParserImpl
org.apache.commons.net.ftp.parser.RegexFTPFileEntryParserImpl
org.apache.commons.net.ftp.parser.ConfigurableFTPFileEntryParserImpl
- All Implemented Interfaces:
Configurable,FTPFileEntryParser
- Direct Known Subclasses:
MacOsPeterFTPEntryParser,MVSFTPEntryParser,NetwareFTPEntryParser,NTFTPEntryParser,OS2FTPEntryParser,OS400FTPEntryParser,UnixFTPEntryParser,VMSFTPEntryParser
public abstract class ConfigurableFTPFileEntryParserImpl
extends RegexFTPFileEntryParserImpl
implements Configurable
This abstract class implements the common timestamp parsing algorithm for all the concrete parsers. Classes derived from this one will parse file listings
via a supplied regular expression that pulls out the date portion as a separate string which is passed to the underlying delegate
to handle parsing of the file timestamp.
This class also implements the Configurable interface to allow the parser to be configured from the outside.
- Since:
- 1.4
-
Field Summary
Fields inherited from class org.apache.commons.net.ftp.parser.RegexFTPFileEntryParserImpl
_matcher_ -
Constructor Summary
ConstructorsConstructorDescriptionconstructor for this abstract class.ConfigurableFTPFileEntryParserImpl(String regex, int flags) constructor for this abstract class. -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(FTPClientConfig config) Implements theConfigurableinterface.protected abstract FTPClientConfigEach concrete subclass must define this member to create a default configuration to be used when that subclass is instantiated without aFTPClientConfigparameter being specified.parseTimestamp(String timestampStr) This method is called by the concrete parsers to delegate timestamp parsing to the timestamp parser.Methods inherited from class org.apache.commons.net.ftp.parser.RegexFTPFileEntryParserImpl
getGroupCnt, getGroupsAsString, group, matches, setRegex, setRegexMethods inherited from class org.apache.commons.net.ftp.FTPFileEntryParserImpl
preParse, readNextEntryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.net.ftp.FTPFileEntryParser
parseFTPEntry
-
Constructor Details
-
ConfigurableFTPFileEntryParserImpl
constructor for this abstract class.- Parameters:
regex- Regular expression used main parsing of the file listing.
-
ConfigurableFTPFileEntryParserImpl
constructor for this abstract class.- Parameters:
regex- Regular expression used main parsing of the file listing.flags- the flags to apply, seePattern#compile(String, int). Use 0 for none.- Since:
- 3.4
-
-
Method Details
-
configure
Implements theConfigurableinterface. Configures this parser by delegating to the underlying Configurable FTPTimestampParser implementation, ' passing it the suppliedFTPClientConfigif that is non-null or a default configuration defined by each concrete subclass.- Specified by:
configurein interfaceConfigurable- Parameters:
config- the configuration to be used to configure this parser. If it is null, a default configuration defined by each concrete subclass is used instead.
-
getDefaultConfiguration
Each concrete subclass must define this member to create a default configuration to be used when that subclass is instantiated without aFTPClientConfigparameter being specified.- Returns:
- the default configuration for the subclass.
-
parseTimestamp
This method is called by the concrete parsers to delegate timestamp parsing to the timestamp parser.- Parameters:
timestampStr- the timestamp string pulled from the file listing by the regular expression parser, to be submitted to thetimestampParserfor extracting the timestamp.- Returns:
- a
java.util.Calendarcontaining results of the timestamp parse. - Throws:
ParseException- on parse error
-