本文整理汇总了Java中org.apache.commons.net.ftp.FTPClientConfig.getDateFormatSymbols方法的典型用法代码示例。如果您正苦于以下问题:Java FTPClientConfig.getDateFormatSymbols方法的具体用法?Java FTPClientConfig.getDateFormatSymbols怎么用?Java FTPClientConfig.getDateFormatSymbols使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.net.ftp.FTPClientConfig
的用法示例。
在下文中一共展示了FTPClientConfig.getDateFormatSymbols方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import org.apache.commons.net.ftp.FTPClientConfig; //导入方法依赖的package包/类
/**
* Implementation of the {@link Configurable Configurable}
* interface. Configures this <code>FTPTimestampParser</code> according
* to the following logic:
* <p>
* Set up the {@link FTPClientConfig#setDefaultDateFormatStr(String) defaultDateFormat}
* and optionally the {@link FTPClientConfig#setRecentDateFormatStr(String) recentDateFormat}
* to values supplied in the config based on month names configured as follows:
* </p><p><ul>
* <li>If a {@link FTPClientConfig#setShortMonthNames(String) shortMonthString}
* has been supplied in the <code>config</code>, use that to parse parse timestamps.</li>
* <li>Otherwise, if a {@link FTPClientConfig#setServerLanguageCode(String) serverLanguageCode}
* has been supplied in the <code>config</code>, use the month names represented
* by that {@link FTPClientConfig#lookupDateFormatSymbols(String) language}
* to parse timestamps.</li>
* <li>otherwise use default English month names</li>
* </ul></p><p>
* Finally if a {@link org.apache.commons.net.ftp.FTPClientConfig#setServerTimeZoneId(String) serverTimeZoneId}
* has been supplied via the config, set that into all date formats that have
* been configured.
* </p>
*/
// @Override
public void configure(FTPClientConfig config) {
DateFormatSymbols dfs = null;
String languageCode = config.getServerLanguageCode();
String shortmonths = config.getShortMonthNames();
if (shortmonths != null) {
dfs = FTPClientConfig.getDateFormatSymbols(shortmonths);
} else if (languageCode != null) {
dfs = FTPClientConfig.lookupDateFormatSymbols(languageCode);
} else {
dfs = FTPClientConfig.lookupDateFormatSymbols("en");
}
String recentFormatString = config.getRecentDateFormatStr();
if (recentFormatString == null) {
this.recentDateFormat = null;
} else {
this.recentDateFormat = new SimpleDateFormat(recentFormatString, dfs);
this.recentDateFormat.setLenient(false);
}
String defaultFormatString = config.getDefaultDateFormatStr();
if (defaultFormatString == null) {
throw new IllegalArgumentException("defaultFormatString cannot be null");
}
this.defaultDateFormat = new SimpleDateFormat(defaultFormatString, dfs);
this.defaultDateFormat.setLenient(false);
setServerTimeZone(config.getServerTimeZoneId());
this.lenientFutureDates = config.isLenientFutureDates();
}
示例2: configure
import org.apache.commons.net.ftp.FTPClientConfig; //导入方法依赖的package包/类
/**
* Implementation of the {@link Configurable Configurable}
* interface. Configures this <code>FTPTimestampParser</code> according
* to the following logic:
* <p>
* Set up the {@link FTPClientConfig#setDefaultDateFormatStr(java.lang.String) defaultDateFormat}
* and optionally the {@link FTPClientConfig#setRecentDateFormatStr(String) recentDateFormat}
* to values supplied in the config based on month names configured as follows:
* </p><p><ul>
* <li>If a {@link FTPClientConfig#setShortMonthNames(String) shortMonthString}
* has been supplied in the <code>config</code>, use that to parse parse timestamps.</li>
* <li>Otherwise, if a {@link FTPClientConfig#setServerLanguageCode(String) serverLanguageCode}
* has been supplied in the <code>config</code>, use the month names represented
* by that {@link FTPClientConfig#lookupDateFormatSymbols(String) language}
* to parse timestamps.</li>
* <li>otherwise use default English month names</li>
* </ul></p><p>
* Finally if a {@link org.apache.commons.net.ftp.FTPClientConfig#setServerTimeZoneId(String) serverTimeZoneId}
* has been supplied via the config, set that into all date formats that have
* been configured.
* </p>
*/
public void configure(FTPClientConfig config) {
DateFormatSymbols dfs = null;
String languageCode = config.getServerLanguageCode();
String shortmonths = config.getShortMonthNames();
if (shortmonths != null) {
dfs = FTPClientConfig.getDateFormatSymbols(shortmonths);
} else if (languageCode != null) {
dfs = FTPClientConfig.lookupDateFormatSymbols(languageCode);
} else {
dfs = FTPClientConfig.lookupDateFormatSymbols("en");
}
String recentFormatString = config.getRecentDateFormatStr();
if (recentFormatString == null) {
this.recentDateFormat = null;
} else {
this.recentDateFormat = new SimpleDateFormat(recentFormatString, dfs);
this.recentDateFormat.setLenient(false);
}
String defaultFormatString = config.getDefaultDateFormatStr();
if (defaultFormatString == null) {
throw new IllegalArgumentException("defaultFormatString cannot be null");
}
this.defaultDateFormat = new SimpleDateFormat(defaultFormatString, dfs);
this.defaultDateFormat.setLenient(false);
setServerTimeZone(config.getServerTimeZoneId());
this.lenientFutureDates = config.isLenientFutureDates();
}
示例3: configure
import org.apache.commons.net.ftp.FTPClientConfig; //导入方法依赖的package包/类
public void configure(FTPClientConfig config) {
DateFormatSymbols dfs = null;
String languageCode = config.getServerLanguageCode();
String shortmonths = config.getShortMonthNames();
if(shortmonths != null) {
dfs = FTPClientConfig.getDateFormatSymbols(shortmonths);
} else if(languageCode != null) {
dfs = FTPClientConfig.lookupDateFormatSymbols(languageCode);
} else {
dfs = FTPClientConfig.lookupDateFormatSymbols("en");
}
String recentFormatString = config.getRecentDateFormatStr();
if(recentFormatString == null) {
this.recentDateFormat = null;
} else {
this.recentDateFormat = new SimpleDateFormat(recentFormatString, dfs);
this.recentDateFormat.setLenient(false);
}
String defaultFormatString = config.getDefaultDateFormatStr();
if(defaultFormatString == null) {
throw new IllegalArgumentException("defaultFormatString cannot be null");
} else {
this.defaultDateFormat = new SimpleDateFormat(defaultFormatString, dfs);
this.defaultDateFormat.setLenient(false);
this.setServerTimeZone(config.getServerTimeZoneId());
this.lenientFutureDates = config.isLenientFutureDates();
}
}
示例4: configure
import org.apache.commons.net.ftp.FTPClientConfig; //导入方法依赖的package包/类
/**
* Implementation of the {@link Configurable Configurable}
* interface. Configures this <code>FTPTimestampParser</code> according
* to the following logic:
* <p>
* Set up the {@link FTPClientConfig#setDefaultDateFormatStr(String) defaultDateFormat}
* and optionally the {@link FTPClientConfig#setRecentDateFormatStr(String) recentDateFormat}
* to values supplied in the config based on month names configured as follows:
* </p>
* <ul>
* <li>If a {@link FTPClientConfig#setShortMonthNames(String) shortMonthString}
* has been supplied in the <code>config</code>, use that to parse parse timestamps.</li>
* <li>Otherwise, if a {@link FTPClientConfig#setServerLanguageCode(String) serverLanguageCode}
* has been supplied in the <code>config</code>, use the month names represented
* by that {@link FTPClientConfig#lookupDateFormatSymbols(String) language}
* to parse timestamps.</li>
* <li>otherwise use default English month names</li>
* </ul><p>
* Finally if a {@link org.apache.commons.net.ftp.FTPClientConfig#setServerTimeZoneId(String)
* serverTimeZoneId}
* has been supplied via the config, set that into all date formats that have
* been configured.
* </p>
*/
@Override public void configure(FTPClientConfig config) {
DateFormatSymbols dfs = null;
String languageCode = config.getServerLanguageCode();
String shortmonths = config.getShortMonthNames();
if (shortmonths != null) {
dfs = FTPClientConfig.getDateFormatSymbols(shortmonths);
} else if (languageCode != null) {
dfs = FTPClientConfig.lookupDateFormatSymbols(languageCode);
} else {
dfs = FTPClientConfig.lookupDateFormatSymbols("en");
}
String recentFormatString = config.getRecentDateFormatStr();
setRecentDateFormat(recentFormatString, dfs);
String defaultFormatString = config.getDefaultDateFormatStr();
if (defaultFormatString == null) {
throw new IllegalArgumentException("defaultFormatString cannot be null");
}
setDefaultDateFormat(defaultFormatString, dfs);
setServerTimeZone(config.getServerTimeZoneId());
this.lenientFutureDates = config.isLenientFutureDates();
}