当前位置: 首页>>代码示例>>Java>>正文


Java FTPClientConfig.getDateFormatSymbols方法代码示例

本文整理汇总了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();
    }
 
开发者ID:archos-sa,项目名称:aos-FileCoreLibrary,代码行数:57,代码来源:FTPTimestampParserImpl.java

示例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();
}
 
开发者ID:kmarius,项目名称:xdman,代码行数:56,代码来源:FTPTimestampParserImpl.java

示例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();
   }
}
 
开发者ID:Bolt-Thrower,项目名称:xdm,代码行数:31,代码来源:FTPTimestampParserImpl.java

示例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();
}
 
开发者ID:AriaLyy,项目名称:Aria,代码行数:51,代码来源:FTPTimestampParserImpl.java


注:本文中的org.apache.commons.net.ftp.FTPClientConfig.getDateFormatSymbols方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。