发两个常用的Java 工具包. 来自Apache . . 这年头没几个非j2se的包在手上都不好意思出门 ps:刚刚分手..顺便散分.. Fuck 爱情!!!..

cydp007 2009-01-08 09:34:26


来自Apache 的 io包 ..
http://commons.apache.org/downloads/download_io.cgi
来自Apache 的 lang 包...
http://commons.apache.org/downloads/download_lang.cgi
下面是io包的对比情况:
之前我们需要这样做:
InputStream in = new URL( "http://jakarta.apache.org" ).openStream();
try {
InputStreamReader inR = new InputStreamReader( in );
BufferedReader buf = new BufferedReader( inR );
String line;
while ( ( line = buf.readLine() ) != null ) {
System.out.println( line );
}
} finally {
in.close();
}

有了工具包以后 我们只需这样:
InputStream in = new URL( "http://jakarta.apache.org" ).openStream();
try {
System.out.println( IOUtils.toString( in ) );
} finally {
IOUtils.closeQuietly(in);
}


再来一段Lang包的.. StringUtils 大名鼎鼎.. 自己放狗搜一下就得了..

    *  IsEmpty/IsBlank  - checks if a String contains text
* Trim/Strip - removes leading and trailing whitespace
* Equals - compares two strings null-safe
* IndexOf/LastIndexOf/Contains - null-safe index-of checks
* IndexOfAny/LastIndexOfAny/IndexOfAnyBut/LastIndexOfAnyBut - index-of any of a set of Strings
* ContainsOnly/ContainsNone - does String contains only/none of these characters
* Substring/Left/Right/Mid - null-safe substring extractions
* SubstringBefore/SubstringAfter/SubstringBetween - substring extraction relative to other strings
* Split/Join - splits a String into an array of substrings and vice versa
* Remove/Delete - removes part of a String
* Replace/Overlay - Searches a String and replaces one String with another
* Chomp/Chop - removes the last part of a String
* LeftPad/RightPad/Center/Repeat - pads a String
* UpperCase/LowerCase/SwapCase/Capitalize/Uncapitalize - changes the case of a String
* CountMatches - counts the number of occurrences of one String in another
* IsAlpha/IsNumeric/IsWhitespace/IsAsciiPrintable - checks the characters in a String
* DefaultString - protects against a null input String
* Reverse/ReverseDelimited - reverses a String
* Abbreviate - abbreviates a string using ellipsis
* Difference - compares two Strings and reports on their differences
* LevensteinDistance - the number of changes needed to change one String into another


上面是API里面摘录的..


API地址:http://commons.apache.org/lang/api/org/apache/commons/lang/StringUtils.html


ps: 太生气了. 真TMD憋..
...全文
487 22 打赏 收藏 转发到动态 举报
写回复
用AI写文章
22 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhangzb717 2009-01-19
  • 打赏
  • 举报
回复
up
jiang_jiajia10 2009-01-12
  • 打赏
  • 举报
回复
学习了
jiaping108 2009-01-12
  • 打赏
  • 举报
回复
空即是色~~
nj_dobetter 2009-01-12
  • 打赏
  • 举报
回复
顶!
纯冰糖 2009-01-12
  • 打赏
  • 举报
回复
同情,接分来的
awusoft 2009-01-10
  • 打赏
  • 举报
回复
不好意思,这样的帖子我只能是移到非技术区
Danny 2009-01-09
  • 打赏
  • 举报
回复
没有女人,照样单身
getter 2009-01-09
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 cydp007 的回复:]
引用 5 楼 joejoe1991 的回复:
一直在用自己写的。。。。


自己写的不好意思发出来.. 发发Apache的.就算丢人也不是我.
[/Quote]
cool
getter 2009-01-09
  • 打赏
  • 举报
回复
舊的不去新的不來
總比我這個三無人士要好,無事業,無愛情,無目標...無錢!!無錢!!無錢!!
zou_wei_forever 2009-01-09
  • 打赏
  • 举报
回复
爱情......
fys249931556 2009-01-09
  • 打赏
  • 举报
回复
。。。楼主,对于分手。。平常心,平常心。。
jiang_jiajia10 2009-01-09
  • 打赏
  • 举报
回复
UP
zhentuxiaohao163 2009-01-09
  • 打赏
  • 举报
回复
路过!!!
getter 2009-01-09
  • 打赏
  • 举报
回复
Girls Usually Need Diamond And Money
GUNDAM!!!
女人都愛錢
fy_kenny 2009-01-09
  • 打赏
  • 举报
回复
不知道什么是爱情,估计也没什么爱情,太虚了...

多点钱,自然就走得顺畅多了...
yiyi_wx 2009-01-08
  • 打赏
  • 举报
回复
cydp007 2009-01-08
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 joejoe1991 的回复:]
一直在用自己写的。。。。
[/Quote]

自己写的不好意思发出来.. 发发Apache的.就算丢人也不是我.
joejoe1991 2009-01-08
  • 打赏
  • 举报
回复
一直在用自己写的。。。。
king_spf 2009-01-08
  • 打赏
  • 举报
回复
天蹋不下来,会有更好的!
yami251139 2009-01-08
  • 打赏
  • 举报
回复
呵呵,apache还是有不少好东西的,比如说ab。。。(*%#(&
加载更多回复(2)

23,404

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧