91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 5KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2023-08-04
  • 語言: Java
  • 標簽: apache??ftp??

資源簡介

http://blog.csdn.net/wangchsh2008/article/details/47101423的附件

資源截圖

代碼片段和文件信息

/**
?*?
?*/
package?com.zznode.tnms.ra.c11n.nj.resource.ftp;

import?java.text.ParseException;
import?java.text.ParsePosition;
import?java.text.SimpleDateFormat;
import?java.util.Calendar;
import?java.util.Date;

import?org.apache.commons.net.ftp.parser.FTPTimestampParserImpl;

/**
?*?@desc:?此類的原始貢獻者為hzwei206,?
?*????????解決apache?ftp中文語言環境下,
?*????????FTPClient.listFiles()為空的bug
?*?@author
?*?@since?2015-7-27
?*/
public?class?FTPTimestampParserImplExZH?extends?FTPTimestampParserImpl?{

private?SimpleDateFormat?defaultDateFormat?=?new?SimpleDateFormat(“mm?d?hh:mm“);
private?SimpleDateFormat?recentDateFormat?=?new?SimpleDateFormat(“yyyy?mm?d“);

/**
?*?@author?hzwei206?將中文環境的時間格式進行轉換
?*/
private?String?formatDate_Zh2En(String?timeStrZh)?{
if?(timeStrZh?==?null)?{
return?““;
}

int?len?=?timeStrZh.length();
StringBuffer?sb?=?new?StringBuffer(len);
char?ch?=?‘?‘;
for?(int?i?=?0;?i? ch?=?timeStrZh.charAt(i);
if?((ch?>=?‘0‘?&&?ch?<=?‘9‘)?||?ch?==?‘?‘?||?ch?==?‘:‘)?{
sb.append(ch);
}
}

return?sb.toString();
}

/**
?*?Implements?the?one?{@link?FTPTimestampParser#parseTimestamp(String)?method}?in?the?{@link?FTPTimestampParser
?*?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.
?*?
?*?@see?org.apache.commons.net.ftp.parser.FTPTimestampParser#parseTimestamp(java.lang.String)
?*/
public?Calendar?parseTimestamp(String?timestampStr)?throws?ParseException?{
timestampStr?=?formatDate_Zh2En(timestampStr);
Calendar?now?=?Calendar.getInstance();
now.setTimeZone(this.getServerTimeZone());

Calendar?working?=?Calendar.getInstance();
working.setTimeZone(this.getServerTimeZone());
ParsePosition?pp?=?new?ParsePosition(0);

Date?parsed?=?null;
if?(this.recentDateFormat?!=?null)?{
parsed?=?recentDateFormat.parse(timestampStr?pp);
}
if?(parsed?!=?null?&&?pp.getIndex()?==?timestampStr.length())?{
working.setTime(parsed);
working.set(Calendar.YEAR?now.get(Calendar.YEAR));
if?(working.after(now))?{
working.add(Calendar.YEAR?-1);
}
}?else?{
pp?=?new?ParsePosition(0);
parsed?=?defaultDateFormat.parse(timestampStr?pp);
//?note?length?checks?are?mandatory?for?us?since
//?SimpleDateFormat?methods?will?succeed?if?less?than
//?full?string?is?matched.?They?will?also?accept
//?despite?“leniency“?setting?a?two-digit?number?as
//?a?valid?year?(e.g.?22:04?will?parse?as?22?A.D.)
//?so?could?mistakenly?confuse?an?hour?with?a?year
//?if?we?don‘t?insist?on?full?length?parsing.
if?(parsed?!=?null?&&?pp.getIndex()?==?timestampStr.length())?{
working.setTime(parsed);

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????11362??2015-07-28?10:09??UnixFTPEntryParser.java

?????文件???????3233??2015-07-27?23:17??FTPTimestampParserImplExZH.java

-----------?---------??----------?-----??----

????????????????14595????????????????????2


評論

共有 條評論