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.
_matcher_
Constructor and Description |
---|
ConfigurableFTPFileEntryParserImpl(String regex)
constructor for this abstract class.
|
ConfigurableFTPFileEntryParserImpl(String regex,
int flags)
constructor for this abstract class.
|
Modifier and Type | Method and Description |
---|---|
void |
configure(FTPClientConfig config)
Implementation of the
Configurable
interface. |
protected abstract FTPClientConfig |
getDefaultConfiguration()
Each concrete subclass must define this member to create
a default configuration to be used when that subclass is
instantiated without a
FTPClientConfig
parameter being specified. |
Calendar |
parseTimestamp(String timestampStr)
This method is called by the concrete parsers to delegate
timestamp parsing to the timestamp parser.
|
getGroupCnt, getGroupsAsString, group, matches, setRegex, setRegex
preParse, readNextEntry
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
parseFTPEntry
public ConfigurableFTPFileEntryParserImpl(String regex)
regex
- Regular expression used main parsing of the
file listing.public ConfigurableFTPFileEntryParserImpl(String regex, int flags)
regex
- Regular expression used main parsing of the
file listing.flags
- the flags to apply, see
Pattern#compile(String, int)
. Use 0 for none.public Calendar parseTimestamp(String timestampStr) throws ParseException
timestampStr
- the timestamp string pulled from the
file listing by the regular expression parser, to be submitted
to the timestampParser
for extracting the timestamp.java.util.Calendar
containing results of the
timestamp parse.ParseException
- on parse errorpublic void configure(FTPClientConfig config)
Configurable
interface. Configures this parser by delegating to the
underlying Configurable FTPTimestampParser implementation, '
passing it the supplied FTPClientConfig
if that is non-null or a default configuration defined by
each concrete subclass.configure
in interface Configurable
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.protected abstract FTPClientConfig getDefaultConfiguration()
FTPClientConfig
parameter being specified.Copyright © 2001–2016 The Apache Software Foundation. All rights reserved.