Top 16 Java 应用类 - 这些功能再也不用自己写了
Java中有很多应用类。这些类定义静态方法能够解决非常多常见的问题。以下是通过5万个开源项目统计得到的最热门的16个应用类。 类按热门程序排列。类的方法也是按热门程序排序。
浏览这个类能够看看有哪些功能不用再自己写了。 很实用。 点击链接能够看到详细使用的演示样例。 原文转自: http://www.programcreek.com/2015/12/top-10-java-utility-classes/
1. org.apache.commons.io.IOUtils
class=org.apache.commons.io.IOUtils&method=closeQuietly" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">closeQuietly ( )
- toString ( )
class=org.apache.commons.io.IOUtils&method=copy" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">copy ( )
- toByteArray ( )
- write ( )
- toInputStream ( )
- readLines ( )
- copyLarge ( )
- lineIterator ( )
- readFully ( )
2. org.apache.commons.io.FileUtils
- deleteDirectory ( )
- readFileToString ( )
- deleteQuietly ( )
class=org.apache.commons.io.FileUtils&method=copyFile" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">copyFile ( )
- writeStringToFile ( )
class=org.apache.commons.io.FileUtils&method=forceMkdir" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">forceMkdir ( )
- write ( )
- listFiles ( )
- copyDirectory ( )
- forceDelete ( )
3. org.apache.commons.lang.StringUtils
- isBlank ( )
class=org.apache.commons.lang.StringUtils&method=isNotBlank" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">isNotBlank ( )
class=org.apache.commons.lang.StringUtils&method=isEmpty" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">isEmpty ( )
- isNotEmpty ( )
- equals ( )
- join ( )
- split ( )
- EMPTY
- trimToNull ( )
- replace ( )
class=org.apache.http.util.EntityUtils&method=toString" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">toString ( )
- consume ( )
- toByteArray ( )
- consumeQuietly ( )
- getContentCharSet (
)
5. org.apache.commons.lang3.StringUtils
- isBlank ( )
- isNotBlank ( )
- isEmpty ( )
- isNotEmpty ( )
class=org.apache.commons.lang3.StringUtils&method=join" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">join ( )
- equals ( )
- split ( )
- EMPTY
- replace ( )
class=org.apache.commons.lang3.StringUtils&method=capitalize" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">capitalize ( )
6. org.apache.commons.io.FilenameUtils
class=org.apache.commons.io.FilenameUtils&method=getExtension" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">getExtension ( )
- getBaseName ( )
- getName ( )
- concat ( )
- removeExtension ( )
class=org.apache.commons.io.FilenameUtils&method=normalize" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">normalize ( )
class=org.apache.commons.io.FilenameUtils&method=wildcardMatch" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">wildcardMatch ( )
class=org.apache.commons.io.FilenameUtils&method=separatorsToUnix" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">separatorsToUnix (
)- getFullPath ( )
- isExtension ( )
7. org.springframework.util.StringUtils
- hasText ( )
- hasLength ( )
class=org.springframework.util.StringUtils&method=isEmpty" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">isEmpty ( )
- commaDelimitedListToStringArray
( ) - collectionToDelimitedString
( ) - replace ( )
- delimitedListToStringArray
( ) class=org.springframework.util.StringUtils&method=uncapitalize" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">uncapitalize ( )
class=org.springframework.util.StringUtils&method=collectionToCommaDelimitedString" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">collectionToCommaDelimitedString
( )class=org.springframework.util.StringUtils&method=tokenizeToStringArray" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">tokenizeToStringArray
( )
8. org.apache.commons.lang.ArrayUtils
class=org.apache.commons.lang.ArrayUtils&method=contains" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">contains ( )
- addAll ( )
- clone ( )
class=org.apache.commons.lang.ArrayUtils&method=isEmpty" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">isEmpty ( )
- add ( )
- EMPTY_BYTE_ARRAY
- subarray ( )
- indexOf ( )
- isEquals ( )
class=org.apache.commons.lang.ArrayUtils&method=toObject" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">toObject ( )
class=org.apache.commons.lang.StringEscapeUtils&method=escapeHtml" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">escapeHtml ( )
class=org.apache.commons.lang.StringEscapeUtils&method=unescapeHtml" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">unescapeHtml ( )
- escapeXml ( )
- escapeSql ( )
- unescapeJava ( )
- escapeJava ( )
- escapeJavaScript
( ) - unescapeXml ( )
- unescapeJavaScript
( )
10. org.apache.http.client.utils.URLEncodedUtils
class=org.apache.http.client.utils.URLEncodedUtils&method=format" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">format ( )
- parse ( )
11. org.apache.commons.codec.digest.DigestUtils
class=org.apache.commons.codec.digest.DigestUtils&method=md5Hex" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">md5Hex ( )
- shaHex ( )
- sha256Hex ( )
class=org.apache.commons.codec.digest.DigestUtils&method=sha1Hex" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">sha1Hex ( )
- sha ( )
- md5 ( )
- sha512Hex ( )
class=org.apache.commons.codec.digest.DigestUtils&method=sha1" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">sha1 ( )
12. org.apache.commons.collections.CollectionUtils
- isEmpty ( )
class=org.apache.commons.collections.CollectionUtils&method=isNotEmpty" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">isNotEmpty (
)- select ( )
- transform ( )
- filter ( )
- find ( )
- collect ( )
- forAllDo ( )
class=org.apache.commons.collections.CollectionUtils&method=addAll" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">addAll ( )
- isEqualCollection
( )
13. org.apache.commons.lang3.ArrayUtils
class=org.apache.commons.lang3.ArrayUtils&method=contains" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">contains ( )
- isEmpty ( )
- isNotEmpty ( )
- add ( )
- clone ( )
- addAll ( )
- subarray ( )
- indexOf ( )
- EMPTY_OBJECT_ARRAY
class=org.apache.commons.lang3.ArrayUtils&method=EMPTY_STRING_ARRAY" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">EMPTY_STRING_ARRAY
14. org.apache.commons.beanutils.PropertyUtils
- getProperty ( )
- setProperty ( )
class=org.apache.commons.beanutils.PropertyUtils&method=getPropertyDescriptors" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">getPropertyDescriptors
( )class=org.apache.commons.beanutils.PropertyUtils&method=isReadable" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">isReadable ( )
- copyProperties
( ) - getPropertyDescriptor
( ) - getSimpleProperty
( ) - isWriteable ( )
- setSimpleProperty
( ) class=org.apache.commons.beanutils.PropertyUtils&method=getPropertyType" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">getPropertyType
( )
- unescapeHtml4
( ) - escapeHtml4 ( )
- escapeXml ( )
class=org.apache.commons.lang3.StringEscapeUtils&method=unescapeXml" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">unescapeXml ( )
- escapeJava ( )
- escapeEcmaScript
( ) - unescapeJava (
) - escapeJson ( )
class=org.apache.commons.lang3.StringEscapeUtils&method=escapeXml10" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">escapeXml10 ( )
- copyProperties (
) - getProperty ( )
- setProperty ( )
- describe ( )
- populate ( )
class=org.apache.commons.beanutils.BeanUtils&method=copyProperty" style="margin:0px; padding:0px; text-decoration:none; color:rgb(3,57,143)">copyProperty ( )
- cloneBean ( )
* The utility classes from android are excluded since they are designed for Android apps. If you want to see more details, you can search "utils" in the search portal:http://www.programcreek.com/java-api-examples/index.php.
If the name of a utility class does not contain "utils", the class is not selected.
Also org.apache.commons.lang is the old version of import org.apache.commons.lang3.
Top 16 Java 应用类 - 这些功能再也不用自己写了的更多相关文章
- Java中 util 包 Calendar类制作万年历(不用自己写方法,直接用Java写好的包中的类的方法)
代码前需要了解的关于Calendar类的内容: 1.在util包中,首先要知道Calendar 提供了一个类方法 getInstance,以获得此类型的一个通用的对象.Calendar 的 ...
- 【C#公共帮助类】JsonHelper 操作帮助类, 以后再也不用满地找Json了,拿来直接用
四个主要操作类:JsonConverter .JsonHelper .JsonSplit .AjaxResult 一.JsonConverter: 自定义查询对象转换动态类.object动态类转换j ...
- 有了Swagger2,再也不用为写Api文档头疼了
1.为什么要写Api文档 现在,前后端分离的开发模式已经非常流行,后端开发工程师只负责完成后端接口,前端页面的开发和渲染完全由前端工程师完成. 问题来了,前端工程师怎么知道后端接口的具体定义呢?答案是 ...
- [iconfont_dart]帮你快速生成Icon,再也不用手动写Icon方法
iconfont_dart iconfont to dart.Icon can be implemented by calling iconfont classname. iconfont转dart. ...
- Java File 类的使用方法详解
Java File类的功能非常强大,利用Java基本上可以对文件进行所有的操作.本文将对Java File文件操作类进行详细地分析,并将File类中的常用方法进行简单介绍,有需要的Java开发者可以看 ...
- Java File 类的使用方法详解(转)
转自:http://www.codeceo.com/article/java-file-class.html Java File类的功能非常强大,利用Java基本上可以对文件进行所有的操作.本文将对J ...
- Java:利用java Timer类实现定时执行任务的功能
一.概述 在java中实现定时执行任务的功能,主要用到两个类,Timer和TimerTask类.其中Timer是用来在一个后台线程按指定的计划来执行指定的任务.TimerTask一个抽象类,它的子类代 ...
- Java定时任务:利用java Timer类实现定时执行任务的功能
一.概述 在java中实现定时执行任务的功能,主要用到两个类,Timer和TimerTask类.其中Timer是用来在一个后台线程按指定的计划来执行指定的任务. TimerTask一个抽象类,它的子类 ...
- 简单练习题2编写Java应用程序。首先定义一个描述银行账户的Account类,包括成员变 量“账号”和“存款余额”,成员方法有“存款”、“取款”和“余额查询”。其次, 编写一个主类,在主类中测试Account类的功能
编写Java应用程序.首先定义一个描述银行账户的Account类,包括成员变 量“账号”和“存款余额”,成员方法有“存款”.“取款”和“余额查询”.其次, 编写一个主类,在主类中测试Account类的 ...
随机推荐
- 汇编中中括号[]作用以及lea和mov指令的区别
现在总结一下:其中牵扯到lea指令,mov指令,[] 一.lea指令:对于寄存器来说:第二个操作数是寄存器必须要加[],不然报错,这里lea就是取[寄存器]的值,如:mov eax,2lea ebx, ...
- thinkphp5.0的验证码安装和相关错误
thinkphp5.0的验证码安装和相关错误 问题 只要是之前使用thinkphp5框架搭建网站的时候发现不管如何调用验证码都无法使用,按照官网要求,使用composer安装验证码出现报错Fatal ...
- DNS SOA NS区别
转自 http://bbs.51cto.com/thread-908637-1.html NS服务器里有两个比较重要的记录.一个叫SOA记录(起始授权机构) 一个叫NS(Name Server)记录( ...
- Scala基础简述
* Scala基础简述 本文章作为Scala快速学习的教程,前提环境是:我假设在此之前,你已经学会了Java编程语言,并且我们以随学随用为目标(在此不会深度挖掘探讨Scala更高级层次的知识).其中语 ...
- 51Nod 1007 正整数分组(01背包)
将一堆正整数分为2组,要求2组的和相差最小. 例如:1 2 3 4 5,将1 2 4分为1组,3 5分为1组,两组和相差1,是所有方案中相差最少的. Input 第1行:一个数N,N为正整数的数量. ...
- Chrome Service Model
Chrome Service Model John Abd-El-Malek February 2016 Objective Move Chrome codebase towards a servic ...
- XAMPP添加多个站点之httpd-vhosts.conf 设置
1.在xampp\apache\conf\httpd.conf设置路径DocumentRoot和Directory 必须与xampp\apache\conf\extra\httpd-vhosts.co ...
- 记intel杯比赛中各种bug与debug【其一】:安装intel caffe
因为intel杯创新软件比赛过程中,并没有任何记录.现在用一点时间把全过程重演一次用作记录. 学习 pytorch 一段时间后,intel比赛突然不让用 pytoch 了,于是打算转战intel ca ...
- 紫书 习题 10-13 UVa 11526(打表找规律+分步枚举)
首先看这道题目,我预感商数肯定是有规律的排列的,于是我打表找一下规律 100 / 1 = 100 100 / 2 = 50 100 / 3 = 33 100 / 4 = 25 100 / 5 = ...
- [USACO15JAN]草鉴定Grass Cownoisseur(分层图+tarjan)
[USACO15JAN]草鉴定Grass Cownoisseur 题目描述 In an effort to better manage the grazing patterns of his cows ...