ibcadmin 发表于 2019-10-17 09:44:11

【Java基础】Java开发过程中的常用工具类库

<p >目次</p>
   
      <ul>
      <li>Java开发过程中的常用工具类库<ul>
      <li>Apache Commons类库</li>
      <li>Guava类库</li>
      <li>Spring中的常用工具类</li>
      <li>其他工具</li>
      <li>参考</li>
      </ul></li>
      </ul>
   

<h2 id="java开发过程中的常用工具类库">Java开发过程中的常用工具类库</h2>
<hr />
<hr />
<h3 id="apache-commons类库">Apache Commons类库</h3>
<p>ApacheCommons是一个非常有用的工具包,为解决各种现实的问题提供了通用现成的代码,不须要我们程序员再重复造轮子。关于这个类库的具体介绍可以访问官网介绍。下面表格列出了部分的工具包。我们平常开发过程中可以根据本身的须要挑选符合的工具包。</p>
<table>
<thead>
<tr >
<th>Components</th>
<th>Description</th>
<th>Latest Version</th>
<th>Released</th>
</tr>
</thead>
<tbody>
<tr >
<td>BCEL</td>
<td>Byte Code Engineering Library - analyze, create, and manipulate Java class files</td>
<td>6.3.1</td>
<td>2019/3/24</td>
</tr>
<tr >
<td>BeanUtils</td>
<td>Easy-to-use wrappers around the Java reflection and introspection APIs.</td>
<td>1.9.3</td>
<td>2016/9/26</td>
</tr>
<tr >
<td>BSF</td>
<td>Bean Scripting Framework - interface to scripting languages, including JSR-223</td>
<td>3.1</td>
<td>2010/6/24</td>
</tr>
<tr >
<td>Chain</td>
<td>Chain of Responsibility pattern implemention.</td>
<td>1.2</td>
<td>2008/6/2</td>
</tr>
<tr >
<td>CLI</td>
<td>Command Line arguments parser.</td>
<td>1.4</td>
<td>2017/3/9</td>
</tr>
<tr >
<td>Codec</td>
<td>General encoding/decoding algorithms (for example phonetic, base64, URL).</td>
<td>1.12</td>
<td>2019/2/16</td>
</tr>
<tr >
<td>Collections</td>
<td>Extends or augments the Java Collections Framework.</td>
<td>4.3</td>
<td>2019/2/5</td>
</tr>
<tr >
<td>Compress</td>
<td>Defines an API for working with tar, zip and bzip2 files.</td>
<td>1.18</td>
<td>2018/8/16</td>
</tr>
<tr >
<td>Configuration</td>
<td>Reading of configuration/preferences files in various formats.</td>
<td>2.4</td>
<td>2018/10/29</td>
</tr>
<tr >
<td>Crypto</td>
<td>A cryptographic library optimized with AES-NI wrapping Openssl or JCE algorithm implementations.</td>
<td>1.0.0</td>
<td>2016/7/22</td>
</tr>
<tr >
<td>CSV</td>
<td>Component for reading and writing comma separated value files.</td>
<td>1.6</td>
<td>2018/9/25</td>
</tr>
<tr >
<td>Daemon</td>
<td>Alternative invocation mechanism for unix-daemon-like java code.</td>
<td>1.0.15</td>
<td>2013/4/3</td>
</tr>
<tr >
<td>DBCP</td>
<td>Database connection pooling services.</td>
<td>2.6.0</td>
<td>2019/2/19</td>
</tr>
<tr >
<td>DbUtils</td>
<td>JDBC helper library.</td>
<td>1.7</td>
<td>2017/7/20</td>
</tr>
<tr >
<td>Digester</td>
<td>XML-to-Java-object mapping utility.</td>
<td>3.2</td>
<td>2011/12/13</td>
</tr>
<tr >
<td>Email</td>
<td>Library for sending e-mail from Java.</td>
<td>1.5</td>
<td>2017/8/1</td>
</tr>
<tr >
<td>Exec</td>
<td>API for dealing with external process execution and environment management in Java.</td>
<td>1.3</td>
<td>2014/11/6</td>
</tr>
<tr >
<td>FileUpload</td>
<td>File upload capability for your servlets and web applications.</td>
<td>1.4</td>
<td>2019/1/16</td>
</tr>
<tr >
<td>Functor</td>
<td>A functor is a function that can be manipulated as an object, or an object representing a single, generic function.</td>
<td>1</td>
<td>2011-??-??</td>
</tr>
<tr >
<td>Geometry</td>
<td>Space and coordinates.</td>
<td>1</td>
<td>2018-??-??</td>
</tr>
<tr >
<td>Imaging (previously called Sanselan)</td>
<td>A pure-Java image library.</td>
<td>0.97-incubator</td>
<td>2009/2/20</td>
</tr>
<tr >
<td>IO</td>
<td>Collection of I/O utilities.</td>
<td>2.6</td>
<td>2017/10/15</td>
</tr>
<tr >
<td>JCI</td>
<td>Java Compiler Interface</td>
<td>1.1</td>
<td>2013/10/14</td>
</tr>
<tr >
<td>JCS</td>
<td>Java Caching System</td>
<td>2.2,1</td>
<td>2018/8/23</td>
</tr>
<tr >
<td>Jelly</td>
<td>XML based scripting and processing engine.</td>
<td>1.0.1</td>
<td>2017/9/27</td>
</tr>
<tr >
<td>Jexl</td>
<td>Expression language which extends the Expression Language of the JSTL.</td>
<td>3.1</td>
<td>2017/4/14</td>
</tr>
<tr >
<td>JXPath</td>
<td>Utilities for manipulating Java Beans using the XPath syntax.</td>
<td>1.3</td>
<td>2008/8/14</td>
</tr>
<tr >
<td>Lang</td>
<td>Provides extra functionality for classes in java.lang.</td>
<td>3.9</td>
<td>2019/4/15</td>
</tr>
<tr >
<td>Logging</td>
<td>Wrapper around a variety of logging API implementations.</td>
<td>1.2</td>
<td>2014/7/11</td>
</tr>
<tr >
<td>Math</td>
<td>Lightweight, self-contained mathematics and statistics components.</td>
<td>3.5</td>
<td>2015/4/17</td>
</tr>
<tr >
<td>Net</td>
<td>Collection of network utilities and protocol implementations.</td>
<td>3.6</td>
<td>2017/2/15</td>
</tr>
<tr >
<td>Numbers</td>
<td>Number types (complex, quaternion, fraction) and utilities (arrays, combinatorics).</td>
<td>1</td>
<td>2017-??-??</td>
</tr>
<tr >
<td>OGNL</td>
<td>An Object-Graph Navigation Language</td>
<td>4</td>
<td>2013-??-??</td>
</tr>
<tr >
<td>Pool</td>
<td>Generic object pooling component.</td>
<td>2.6.2</td>
<td>2019/4/11</td>
</tr>
<tr >
<td>Proxy</td>
<td>Library for creating dynamic proxies.</td>
<td>1</td>
<td>2008/2/28</td>
</tr>
<tr >
<td>RDF</td>
<td>Common implementation of RDF 1.1 that could be implemented by systems on the JVM.</td>
<td>0.3.0-incubating</td>
<td>2016/11/15</td>
</tr>
<tr >
<td>RNG</td>
<td>Implementations of random numbers generators.</td>
<td>1.2</td>
<td>2018/12/12</td>
</tr>
<tr >
<td>SCXML</td>
<td>An implementation of the State Chart XML specification aimed at creating and maintaining a Java SCXML engine.It is capable of executing a state machine defined using a SCXML document, and abstracts out the environment interfaces.</td>
<td>0.9</td>
<td>2008/12/1</td>
</tr>
<tr >
<td>Statistics</td>
<td>Statistics.</td>
<td>0.1</td>
<td>????-??-??</td>
</tr>
<tr >
<td>Text</td>
<td>Apache Commons Text is a library focused on algorithms working on strings.</td>
<td>1.6</td>
<td>2018/10/16</td>
</tr>
<tr >
<td>Validator</td>
<td>Framework to define validators and validation rules in an xml file.</td>
<td>1.6</td>
<td>2017/2/21</td>
</tr>
<tr >
<td>VFS</td>
<td>Virtual File System component for treating files, FTP, SMB, ZIP and such like as a single logical file system.</td>
<td>2.3</td>
<td>2019/2/4</td>
</tr>
<tr >
<td>Weaver</td>
<td>Provides an easy way to enhance (weave) compiled bytecode.</td>
<td>2</td>
<td>2018/9/7</td>
</tr>
</tbody>
</table>
<p>除了上面表格中的工具包,Apache Common项目还包括以下几个工具包,此中的http-client是我们平常非常常用的。</p>
<ul>
<li>Cactus: Cactus is a simple test framework for unit testing server-side java code (Servlets, EJBs, Tag Libs, Filters, ...). The intent of Cactus is to lower the cost of writing tests for server-side code.</li>
<li>HiveMind: HiveMind is a services and configuration microkernel. HiveMind allows you to create your application using a service oriented architecture.</li>
<li>HttpClient 3.x: Framework for working with the client-side of the HTTP protocol.</li>
<li>Naming: The Naming subproject will contain common JNDI code along with various JNDI providers.</li>
</ul>
<h3 id="guava类库">Guava类库</h3>
<p>Guava工程包罗了多少被Google的 Java项目广泛依赖 的焦点库,例如:聚集 、缓存 、原生范例支持 、并发库 、通用注解 、字符串处理惩罚 、I/O 等等。下面列出Guava工具包中的常勤奋能点,以便须要的时间查阅利用。</p>
<h4 id="基本工具-basic-utilities">基本工具 </h4>
<ul>
<li>利用和制止null:null是模棱两可的,会引起令人狐疑的错误,有些时间它让人很不舒服。很多Guava工具类用快速失败拒绝null值,而不是盲目地继承。</li>
<li>前置条件: 让方法中的条件检查更简朴。</li>
<li>常见Object方法: 简化Object方法实现,如hashCode()和toString()。</li>
<li>排序: Guava强大的”流透风格比较器”</li>
<li>Throwables:简化了非常和错误的传播与检查。</li>
</ul>
<h4 id="聚集collections">聚集</h4>
<p>Guava对JDK聚集的扩展,这是Guava最成熟和为人所知的部分</p>
<ul>
<li>不可变聚集: 用稳定的聚集举行防御性编程和性能提升。</li>
<li>新聚集范例: multisets, multimaps, tables, bidirectional maps等。</li>
<li>强大的聚集工具类: 提供java.util.Collections中没有的聚集工具。</li>
<li>扩展工具类:让实现和扩展聚集类变得更轻易,比如创建Collection的装饰器,或实现迭代器。</li>
</ul>
<h4 id="缓存caches">缓存</h4>
<p>Guava Cache:本地缓存实现,支持多种缓存逾期策略。</p>
<h4 id="函数式风格functional-idioms">函数式风格</h4>
<p>Guava的函数式支持可以明显简化代码,但请审慎利用它。</p>
<h4 id="并发concurrency">并发</h4>
<p>强大而简朴的抽象,让编写精确的并发代码更简朴</p>
<ul>
<li>ListenableFuture:完成后触发回调的Future</li>
<li>Service框架:抽象可开启和关闭的服务,帮助你维护服务的状态逻辑</li>
</ul>
<h4 id="字符串处理惩罚strings">字符串处理惩罚</h4>
<p>非常有用的字符串工具,包括分割、毗连、添补等操作</p>
<h4 id="原生范例primitives">原生范例</h4>
<p>扩展 JDK 未提供的原生范例(如int、char)操作, 包括某些范例的无符号情势</p>
<h4 id="区间ranges">区间</h4>
<p>可比较范例的区间API,包括一连和离散范例</p>
<h4 id="io">I/O</h4>
<p>简化I/O尤其是I/O流和文件的操作,针对Java5和6版本</p>
<h4 id="散列hash">散列</h4>
<p>提供比Object.hashCode()更复杂的散列实现,并提供布鲁姆过滤器的实现</p>
<h4 id="变乱总线eventbus">变乱总线</h4>
<p>发布-订阅模式的组件通讯,但组件不须要显式地注册到其他组件中</p>
<h4 id="数学运算math">数学运算</h4>
<p>优化的、充实测试的数学工具类</p>
<h4 id="反射reflection">反射</h4>
<p>Guava 的 Java 反射机制工具类</p>
<h3 id="spring中的常用工具类">Spring中的常用工具类</h3>
<ul>
<li>FileCopyUtils;</li>
<li>WebUtil;</li>
</ul>
<p>参考下面博客:<br />
https://www.cnblogs.com/davidwang456/p/4106519.html<br />
https://www.jb51.net/article/125424.htm</p>
<h3 id="其他工具">其他工具</h3>
<p>后续逐渐添加~</p>
<h3 id="参考">参考</h3>
<ul>
<li>并发编程网Guava教程</li>
<li>Apache Common官网</li>
</ul><br><br/><br/><br/><br/><br/>来源:<a href="https://www.cnblogs.com/54chensongxia/p/11688868.html" target="_blank">https://www.cnblogs.com/54chensongxia/p/11688868.html</a>
页: [1]
查看完整版本: 【Java基础】Java开发过程中的常用工具类库