public class FTPTimestampParserImpl extends java.lang.Object implements FTPTimestampParser, Configurable
FTPTimestampParser
interface also implements the Configurable
interface to allow the parsing to be configured from the outside.ConfigurableFTPFileEntryParserImpl
DEFAULT_RECENT_SDF, DEFAULT_SDF
构造器和说明 |
---|
FTPTimestampParserImpl()
The only constructor for this class.
|
限定符和类型 | 方法和说明 |
---|---|
void |
configure(FTPClientConfig config)
Implementation of the
Configurable
interface. |
java.text.SimpleDateFormat |
getDefaultDateFormat() |
java.lang.String |
getDefaultDateFormatString() |
java.text.SimpleDateFormat |
getRecentDateFormat() |
java.lang.String |
getRecentDateFormatString() |
java.util.TimeZone |
getServerTimeZone() |
java.lang.String[] |
getShortMonths() |
java.util.Calendar |
parseTimestamp(java.lang.String timestampStr)
Implements the one
method
in the FTPTimestampParser interface
according to this algorithm:
If the recentDateFormat member has been defined, try to parse the
supplied string with that. |
java.util.Calendar |
parseTimestamp(java.lang.String timestampStr,
java.util.Calendar serverTime)
If the recentDateFormat member has been defined, try to parse the
supplied string with that.
|
public java.util.Calendar parseTimestamp(java.lang.String timestampStr) throws java.text.ParseException
method
in the FTPTimestampParser
interface
according to this algorithm:
If the recentDateFormat member has been defined, try to parse the
supplied string with that. If that parse fails, or if the recentDateFormat
member has not been defined, attempt to parse with the defaultDateFormat
member. If that fails, throw a ParseException.
This method assumes that the server time is the same as the local time.parseTimestamp
在接口中 FTPTimestampParser
timestampStr
- The timestamp to be parsedjava.text.ParseException
- if none of the parser mechanisms belonging to
the implementor can parse the input.parseTimestamp(String, Calendar)
public java.util.Calendar parseTimestamp(java.lang.String timestampStr, java.util.Calendar serverTime) throws java.text.ParseException
Calendar
instance to be passed in which represents the
current (system) time.timestampStr
- The timestamp to be parsedserverTime
- The current time for the serverjava.text.ParseException
- if timestamp cannot be parsedFTPTimestampParser.parseTimestamp(String)
public java.text.SimpleDateFormat getDefaultDateFormat()
public java.lang.String getDefaultDateFormatString()
public java.text.SimpleDateFormat getRecentDateFormat()
public java.lang.String getRecentDateFormatString()
public java.lang.String[] getShortMonths()
public java.util.TimeZone getServerTimeZone()
public void configure(FTPClientConfig config)
Configurable
interface. Configures this FTPTimestampParser
according
to the following logic:
Set up the defaultDateFormat
and optionally the recentDateFormat
to values supplied in the config based on month names configured as follows:
shortMonthString
has been supplied in the config
, use that to parse parse timestamps.serverLanguageCode
has been supplied in the config
, use the month names represented
by that language
to parse timestamps.
Finally if a serverTimeZoneId
has been supplied via the config, set that into all date formats that have
been configured.
configure
在接口中 Configurable
config
- the object containing the configuration data