Class FTPTimestampParserImpl
java.lang.Object
org.apache.commons.net.ftp.parser.FTPTimestampParserImpl
- All Implemented Interfaces:
- Configurable,- FTPTimestampParser
Default implementation of the 
FTPTimestampParser interface also implements the Configurable interface to allow the parsing to be configured from the outside.- Since:
- 1.4
- See Also:
- 
Field SummaryFields inherited from interface org.apache.commons.net.ftp.parser.FTPTimestampParserDEFAULT_RECENT_SDF, DEFAULT_SDF
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidconfigure(FTPClientConfig config) Implements theConfigurableinterface.String[]parseTimestamp(String timestampStr) Implements the onemethodin theFTPTimestampParserinterface according to this algorithm: If the recentDateFormat member has been defined, try to parse the supplied string with that.parseTimestamp(String timestampStr, Calendar serverTime) If the recentDateFormat member has been defined, try to parse the supplied string with that.
- 
Constructor Details- 
FTPTimestampParserImplpublic FTPTimestampParserImpl()The only constructor for this class.
 
- 
- 
Method Details- 
configureImplements theConfigurableinterface. Configures thisFTPTimestampParseraccording to the following logic:Sets up the defaultDateFormatand optionally therecentDateFormatto values supplied in the config based on month names configured as follows:- If a shortMonthStringhas been supplied in theconfig, use that to parse parse timestamps.
- Otherwise, if a serverLanguageCodehas been supplied in theconfig, use the month names represented by thatlanguageto parse timestamps.
- otherwise use default English month names
 Finally if a serverTimeZoneIdhas been supplied via the config, set that into all date formats that have been configured.- Specified by:
- configurein interface- Configurable
- Parameters:
- config- the object containing the configuration data
 
- If a 
- 
getDefaultDateFormat- Returns:
- Returns the defaultDateFormat.
 
- 
getDefaultDateFormatString- Returns:
- Returns the defaultDateFormat pattern string.
 
- 
getRecentDateFormat- Returns:
- Returns the recentDateFormat.
 
- 
getRecentDateFormatString- Returns:
- Returns the recentDateFormat.
 
- 
getServerTimeZone- Returns:
- Returns the serverTimeZone used by this parser.
 
- 
getShortMonths- Returns:
- returns an array of 12 strings representing the short month names used by this parse.
 
- 
parseTimestampImplements the onemethodin theFTPTimestampParserinterface 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.- Specified by:
- parseTimestampin interface- FTPTimestampParser
- Parameters:
- timestampStr- The timestamp to be parsed
- Returns:
- a Calendar with the parsed timestamp
- Throws:
- ParseException- if none of the parser mechanisms belonging to the implementor can parse the input.
- See Also:
 
- 
parseTimestampIf 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 allows aCalendarinstance to be passed in which represents the current (system) time.- Parameters:
- timestampStr- The timestamp to be parsed
- serverTime- The current time for the server
- Returns:
- the calendar
- Throws:
- ParseException- if timestamp cannot be parsed
- Since:
- 1.5
- See Also:
 
 
-