ftpclientconfig.java

来自「apache推出的net包」· Java 代码 · 共 518 行 · 第 1/2 页

JAVA
518
字号
		// some don't		LANGUAGE_CODE_MAP.put("fr",			        "jan|f\u00e9v|mar|avr|mai|jun|jui|ao\u00fb|sep|oct|nov|d\u00e9c");  //french				}		/**	 * Getter for the serverSystemKey property.  This property     * specifies the general type of server to which the client connects.     * Should be either one of the <code>FTPClientConfig.SYST_*</code> codes     * or else the fully qualified class name of a parser implementing both     * the <code>FTPFileEntryParser</code> and <code>Configurable</code>     * interfaces.	 * @return Returns the serverSystemKey property.	 */	public String getServerSystemKey() {		return serverSystemKey;	}		/**	 * getter for the {@link  #setDefaultDateFormatStr(String)  defaultDateFormatStr} 	 * property.  	 * @return Returns the defaultDateFormatStr property.	 */	public String getDefaultDateFormatStr() {		return defaultDateFormatStr;	}		/**	 * getter for the {@link  #setRecentDateFormatStr(String)  recentDateFormatStr} property.	 * @return Returns the recentDateFormatStr property.	 */	public String getRecentDateFormatStr() {		return recentDateFormatStr;	}		/**	 * getter for the {@link  #setServerTimeZoneId(String)  serverTimeZoneId} property.	 * @return Returns the serverTimeZoneId property.	 */	public String getServerTimeZoneId() {		return serverTimeZoneId;	}		/**	 * <p>	 * getter for the {@link  #setShortMonthNames(String)  shortMonthNames} 	 * property.  	 * </p>	 * @return Returns the shortMonthNames.	 */	public String getShortMonthNames() {		return shortMonthNames;	}		/**	 * <p>	 * getter for the {@link  #setServerLanguageCode(String)  serverLanguageCode} property.	 * </p>  * 	 * @return Returns the serverLanguageCode property.	 */	public String getServerLanguageCode() {		return serverLanguageCode;	}		/**	 * <p>	 * setter for the defaultDateFormatStr property.  This property	 * specifies the main date format that will be used by a parser configured	 * by this configuration to parse file timestamps.  If this is not	 * specified, such a parser will use as a default value, the most commonly	 * used format which will be in as used in <code>en_US</code> locales.	 * </p><p>	 * This should be in the format described for 	 * <code>java.text.SimpleDateFormat</code>. 	 * property.	 * </p>	 * @param defaultDateFormatStr The defaultDateFormatStr to set.	 */	public void setDefaultDateFormatStr(String defaultDateFormatStr) {		this.defaultDateFormatStr = defaultDateFormatStr;	}		/**	 * <p>	 * setter for the recentDateFormatStr property.  This property	 * specifies a secondary date format that will be used by a parser 	 * configured by this configuration to parse file timestamps, typically 	 * those less than a year old.  If this is  not specified, such a parser 	 * will not attempt to parse using an alternate format.	 * </p>	 * This is used primarily in unix-based systems.	 * </p>	 * This should be in the format described for 	 * <code>java.text.SimpleDateFormat</code>.	 * </p>	 * @param recentDateFormatStr The recentDateFormatStr to set.	 */	public void setRecentDateFormatStr(String recentDateFormatStr) {		this.recentDateFormatStr = recentDateFormatStr;	}		/**	 * <p>	 * setter for the serverTimeZoneId property.  This property	 * allows a time zone to be specified corresponding to that known to be 	 * used by an FTP server in file listings.  This might be particularly 	 * useful to clients such as Ant that try to use these timestamps for 	 * dependency checking.	 * </p><p>	 * This should be one of the identifiers used by 	 * <code>java.util.TimeZone</code> to refer to time zones, for example, 	 * <code>America/Chicago</code> or <code>Asia/Rangoon</code>.	 * </p>	 * @param serverTimeZoneId The serverTimeZoneId to set.	 */	public void setServerTimeZoneId(String serverTimeZoneId) {		this.serverTimeZoneId = serverTimeZoneId;	}		/**	 * <p>	 * setter for the shortMonthNames property.  	 * This property allows the user to specify a set of month names	 * used by the server that is different from those that may be 	 * specified using the {@link  #setServerLanguageCode(String)  serverLanguageCode}	 * property.	 * </p><p>	 * This should be a string containing twelve strings each composed of	 * three characters, delimited by pipe (|) characters.  Currently, 	 * only 8-bit ASCII characters are known to be supported.  For example,	 * a set of month names used by a hypothetical Icelandic FTP server might 	 * conceivably be specified as 	 * <code>"jan|feb|mar|apr|ma&#xED;|j&#xFA;n|j&#xFA;l|&#xE1;g&#xFA;|sep|okt|n&#xF3;v|des"</code>.  	 * </p>	 * @param shortMonthNames The value to set to the shortMonthNames property.	 */	public void setShortMonthNames(String shortMonthNames) {		this.shortMonthNames = shortMonthNames;	}		/**	 * <p>	 * setter for the serverLanguageCode property.  This property allows	 * user to specify a 	 * <a href="http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt">	 * two-letter ISO-639 language code</a> that will be used to 	 * configure the set of month names used by the file timestamp parser.	 * If neither this nor the {@link #setShortMonthNames(String) shortMonthNames} 	 * is specified, parsing will assume English month names, which may or 	 * may not be significant, depending on whether the date format(s) 	 * specified via {@link  #setDefaultDateFormatStr(String)  defaultDateFormatStr} 	 * and/or {@link  #setRecentDateFormatStr(String)  recentDateFormatStr} are using 	 * numeric or alphabetic month names.	 * </p>	 * <p>If the code supplied is not supported here, <code>en_US</code>	 * month names will be used.  We are supporting here those language 	 * codes which, when a <code> java.util.Locale</code> is constucted	 * using it, and a <code>java.text.SimpleDateFormat</code> is 	 * constructed using that Locale, the array returned by the 	 * SimpleDateFormat's <code>getShortMonths()</code> method consists	 * solely of three 8-bit ASCII character strings.  Additionally, 	 * languages which do not meet this requirement are included if a 	 * common alternative set of short month names is known to be used.	 * This means that users who can tell us of additional such encodings	 * may get them added to the list of supported languages by contacting	 * the jakarta-commons-net team.	 * </p>	 * <p><strong>	 * Please note that this attribute will NOT be used to determine a 	 * locale-based date format for the language.  </strong>  	 * Experience has shown that many if not most FTP servers outside the	 * United States employ the standard <code>en_US</code> date format 	 * orderings of <code>MMM d yyyy</code> and <code>MMM d HH:mm</code> 	 * and attempting to deduce this automatically here would cause more	 * problems than it would solve.  The date format must be changed 	 * via the {@link  #setDefaultDateFormatStr(String)  defaultDateFormatStr} and/or 	 * {@link  #setRecentDateFormatStr(String)  recentDateFormatStr} parameters.	 * </p>	  	 * @param serverLanguageCode The value to set to the serverLanguageCode property.  	 */	public void setServerLanguageCode(String serverLanguageCode) {		this.serverLanguageCode = serverLanguageCode;	}		/**	 * Looks up the supplied language code in the internally maintained table of 	 * language codes.  Returns a DateFormatSymbols object configured with 	 * short month names corresponding to the code.  If there is no corresponding	 * entry in the table, the object returned will be that for 	 * <code>Locale.US</code> 	 * @param languageCode See {@link  #setServerLanguageCode(String)  serverLanguageCode}	 * @return a DateFormatSymbols object configured with short month names 	 * corresponding to the supplied code, or with month names for  	 * <code>Locale.US</code> if there is no corresponding entry in the internal	 * table.	 */	public static DateFormatSymbols lookupDateFormatSymbols(String languageCode) 	{		Object lang = LANGUAGE_CODE_MAP.get(languageCode);		if (lang != null) {			if (lang instanceof Locale) {				return new DateFormatSymbols((Locale) lang);			} else if (lang instanceof String){				return getDateFormatSymbols((String) lang);			}		}		return new DateFormatSymbols(Locale.US);	}		/**	 * Returns a DateFormatSymbols object configured with short month names	 * as in the supplied string	 * @param shortmonths This  should be as described in 	 *  {@link  #setShortMonthNames(String)  shortMonthNames}	 * @return a DateFormatSymbols object configured with short month names	 * as in the supplied string	 */	public static DateFormatSymbols getDateFormatSymbols(String shortmonths) 	{		String[] months = splitShortMonthString(shortmonths);		DateFormatSymbols dfs = new DateFormatSymbols(Locale.US);		dfs.setShortMonths(months);		return dfs;	}		private static String[] splitShortMonthString(String shortmonths) {		StringTokenizer st = new StringTokenizer(shortmonths, "|");		int monthcnt = st.countTokens();		if (12 != monthcnt) {			throw new IllegalArgumentException(					"expecting a pipe-delimited string containing 12 tokens");		}		String[] months = new String[13];		int pos = 0;		while(st.hasMoreTokens()) {			months[pos++] = st.nextToken();		}		months[pos]="";		return months;	}	/**	 * Returns a Collection of all the language codes currently supported	 * by this class. See {@link  #setServerLanguageCode(String)  serverLanguageCode}  	 * for a functional descrption of language codes within this system. 	 * 		 * @return a Collection of all the language codes currently supported	 * by this class	 */	public static Collection getSupportedLanguageCodes() {	    return LANGUAGE_CODE_MAP.keySet();	}		}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?