|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.net.ftp.parser.FTPTimestampParserImpl
public class FTPTimestampParserImpl
Default implementation of the FTPTimestampParser
interface also implements the Configurable
interface to allow the parsing to be configured from the outside.
ConfigurableFTPFileEntryParserImpl
Field Summary |
---|
Fields inherited from interface org.apache.commons.net.ftp.parser.FTPTimestampParser |
---|
DEFAULT_RECENT_SDF, DEFAULT_SDF |
Constructor Summary | |
---|---|
FTPTimestampParserImpl()
The only constructor for this class. |
Method Summary | |
---|---|
void |
configure(FTPClientConfig config)
Implementation of the Configurable
interface. |
SimpleDateFormat |
getDefaultDateFormat()
|
String |
getDefaultDateFormatString()
|
SimpleDateFormat |
getRecentDateFormat()
|
String |
getRecentDateFormatString()
|
TimeZone |
getServerTimeZone()
|
String[] |
getShortMonths()
|
Calendar |
parseTimestamp(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. |
Calendar |
parseTimestamp(String timestampStr,
Calendar serverTime)
If the recentDateFormat member has been defined, try to parse the supplied string with that. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FTPTimestampParserImpl()
Method Detail |
---|
public Calendar parseTimestamp(String timestampStr) throws 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
in interface FTPTimestampParser
timestampStr
- The timestamp to be parsed
java.util.Calendar
object initialized to the date
parsed by the parser
ParseException
- if none of the parser mechanisms belonging to
the implementor can parse the input.parseTimestamp(String, Calendar)
public Calendar parseTimestamp(String timestampStr, Calendar serverTime) throws ParseException
Calendar
instance to be passed in which represents the
current (system) time.
timestampStr
- The timestamp to be parsedserverTime
- The current time for the server
ParseException
FTPTimestampParser.parseTimestamp(String)
public SimpleDateFormat getDefaultDateFormat()
public String getDefaultDateFormatString()
public SimpleDateFormat getRecentDateFormat()
public String getRecentDateFormatString()
public String[] getShortMonths()
public 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
in interface Configurable
config
- the object containing the configuration data
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |