【Java基础】Java开发过程中的常用工具类库
Java开发过程中的常用工具类库
1. Apache Commons类库
Apache Commons是一个非常有用的工具包,为解决各种实际的问题提供了通用现成的代码,不需要我们程序员再重复造轮子。关于这个类库的详细介绍可以访问官网介绍。下面表格列出了部分的工具包。我们平时开发过程中可以根据自己的需要挑选合适的工具包。
| Components | Description | Latest Version | Released |
|---|---|---|---|
| BCEL | Byte Code Engineering Library - analyze, create, and manipulate Java class files | 6.3.1 | 2019/3/24 |
| BeanUtils | Easy-to-use wrappers around the Java reflection and introspection APIs. | 1.9.3 | 2016/9/26 |
| BSF | Bean Scripting Framework - interface to scripting languages, including JSR-223 | 3.1 | 2010/6/24 |
| Chain | Chain of Responsibility pattern implemention. | 1.2 | 2008/6/2 |
| CLI | Command Line arguments parser. | 1.4 | 2017/3/9 |
| Codec | General encoding/decoding algorithms (for example phonetic, base64, URL). | 1.12 | 2019/2/16 |
| Collections | Extends or augments the Java Collections Framework. | 4.3 | 2019/2/5 |
| Compress | Defines an API for working with tar, zip and bzip2 files. | 1.18 | 2018/8/16 |
| Configuration | Reading of configuration/preferences files in various formats. | 2.4 | 2018/10/29 |
| Crypto | A cryptographic library optimized with AES-NI wrapping Openssl or JCE algorithm implementations. | 1.0.0 | 2016/7/22 |
| CSV | Component for reading and writing comma separated value files. | 1.6 | 2018/9/25 |
| Daemon | Alternative invocation mechanism for unix-daemon-like java code. | 1.0.15 | 2013/4/3 |
| DBCP | Database connection pooling services. | 2.6.0 | 2019/2/19 |
| DbUtils | JDBC helper library. | 1.7 | 2017/7/20 |
| Digester | XML-to-Java-object mapping utility. | 3.2 | 2011/12/13 |
| Library for sending e-mail from Java. | 1.5 | 2017/8/1 | |
| Exec | API for dealing with external process execution and environment management in Java. | 1.3 | 2014/11/6 |
| FileUpload | File upload capability for your servlets and web applications. | 1.4 | 2019/1/16 |
| Functor | A functor is a function that can be manipulated as an object, or an object representing a single, generic function. | 1 | 2011-??-?? |
| Geometry | Space and coordinates. | 1 | 2018-??-?? |
| Imaging (previously called Sanselan) | A pure-Java image library. | 0.97-incubator | 2009/2/20 |
| IO | Collection of I/O utilities. | 2.6 | 2017/10/15 |
| JCI | Java Compiler Interface | 1.1 | 2013/10/14 |
| JCS | Java Caching System | 2.2,1 | 2018/8/23 |
| Jelly | XML based scripting and processing engine. | 1.0.1 | 2017/9/27 |
| Jexl | Expression language which extends the Expression Language of the JSTL. | 3.1 | 2017/4/14 |
| JXPath | Utilities for manipulating Java Beans using the XPath syntax. | 1.3 | 2008/8/14 |
| Lang | Provides extra functionality for classes in java.lang. | 3.9 | 2019/4/15 |
| Logging | Wrapper around a variety of logging API implementations. | 1.2 | 2014/7/11 |
| Math | Lightweight, self-contained mathematics and statistics components. | 3.5 | 2015/4/17 |
| Net | Collection of network utilities and protocol implementations. | 3.6 | 2017/2/15 |
| Numbers | Number types (complex, quaternion, fraction) and utilities (arrays, combinatorics). | 1 | 2017-??-?? |
| OGNL | An Object-Graph Navigation Language | 4 | 2013-??-?? |
| Pool | Generic object pooling component. | 2.6.2 | 2019/4/11 |
| Proxy | Library for creating dynamic proxies. | 1 | 2008/2/28 |
| RDF | Common implementation of RDF 1.1 that could be implemented by systems on the JVM. | 0.3.0-incubating | 2016/11/15 |
| RNG | Implementations of random numbers generators. | 1.2 | 2018/12/12 |
| SCXML | 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. | 0.9 | 2008/12/1 |
| Statistics | Statistics. | 0.1 | ????-??-?? |
| Text | Apache Commons Text is a library focused on algorithms working on strings. | 1.6 | 2018/10/16 |
| Validator | Framework to define validators and validation rules in an xml file. | 1.6 | 2017/2/21 |
| VFS | Virtual File System component for treating files, FTP, SMB, ZIP and such like as a single logical file system. | 2.3 | 2019/2/4 |
| Weaver | Provides an easy way to enhance (weave) compiled bytecode. | 2 | 2018/9/7 |
除了上面表格中的工具包,Apache Common项目还包括以下几个工具包,其中的http-client是我们平时非常常用的。
- 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.
- HiveMind: HiveMind is a services and configuration microkernel. HiveMind allows you to create your application using a service oriented architecture.
- HttpClient 3.x: Framework for working with the client-side of the HTTP protocol.
- Naming: The Naming subproject will contain common JNDI code along with various JNDI providers.
2. Guava类库
Guava工程包含了若干被Google的 Java项目广泛依赖 的核心库,例如:集合 [collections] 、缓存 [caching] 、原生类型支持 [primitives support] 、并发库 [concurrency libraries] 、通用注解 [common annotations] 、字符串处理 [string processing] 、I/O 等等。下面列出Guava工具包中的常用功能点,以便需要的时候查阅使用。
2.1 基本工具 [Basic utilities]
- 使用和避免null:null是模棱两可的,会引起令人困惑的错误,有些时候它让人很不舒服。很多Guava工具类用快速失败拒绝null值,而不是盲目地接受。
- 前置条件: 让方法中的条件检查更简单。
- 常见Object方法: 简化Object方法实现,如hashCode()和toString()。
- 排序: Guava强大的”流畅风格比较器”
- Throwables:简化了异常和错误的传播与检查。
2.2 集合[Collections]
Guava对JDK集合的扩展,这是Guava最成熟和为人所知的部分
- 不可变集合: 用不变的集合进行防御性编程和性能提升。
- 新集合类型: multisets, multimaps, tables, bidirectional maps等。
- 强大的集合工具类: 提供java.util.Collections中没有的集合工具。
- 扩展工具类:让实现和扩展集合类变得更容易,比如创建Collection的装饰器,或实现迭代器。
2.3 缓存[Caches]
Guava Cache:本地缓存实现,支持多种缓存过期策略。
2.4 函数式风格[Functional idioms]
Guava的函数式支持可以显著简化代码,但请谨慎使用它。
2.5 并发[Concurrency]
强大而简单的抽象,让编写正确的并发代码更简单
- ListenableFuture:完成后触发回调的Future
- Service框架:抽象可开启和关闭的服务,帮助你维护服务的状态逻辑
2.6 字符串处理[Strings]
非常有用的字符串工具,包括分割、连接、填充等操作
2.7 原生类型[Primitives]
扩展 JDK 未提供的原生类型(如int、char)操作, 包括某些类型的无符号形式
2.8 区间[Ranges]
可比较类型的区间API,包括连续和离散类型
2.9 I/O
简化I/O尤其是I/O流和文件的操作,针对Java5和6版本
2.10 散列[Hash]
提供比Object.hashCode()更复杂的散列实现,并提供布鲁姆过滤器的实现
2.11 事件总线[EventBus]
发布-订阅模式的组件通信,但组件不需要显式地注册到其他组件中
2.12 数学运算[Math]
优化的、充分测试的数学工具类
2.13 反射[Reflection]
Guava 的 Java 反射机制工具类
3. Spring中的常用工具类
- FileCopyUtils;
- WebUtil;
参考下面博客:
https://www.cnblogs.com/davidwang456/p/4106519.html
https://www.jb51.net/article/125424.htm
4. 其他工具
后续逐渐添加~
参考
- 并发编程网Guava教程
- Apache Common官网
【Java基础】Java开发过程中的常用工具类库的更多相关文章
- Java基础-考察JVM内部结构的常用工具介绍
Java基础-考察JVM内部结构的常用工具介绍 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 我们可以通过jvisualvm.exe考察jvm内部结构.而jvisualvm.exe ...
- java 线程之concurrent中的常用工具 CyclicBarrier
一.CyclicBarrier CyclicBarrier是一个同步辅助类,它允许一组线程互相等待,直到到达某个公共屏障点 (common barrier point).在涉及一组固定大小的线程的程序 ...
- 【Java基础】【14正则表达式&常用工具类】
14.01_常见对象(正则表达式的概述和简单使用) A:正则表达式 是指一个用来描述或者匹配一系列符合某个语法规则的字符串的单个字符串.其实就是一种规则.有自己特殊的应用. 作用:比如注册邮箱,邮箱有 ...
- Java基础-Java中23种设计模式之常用的设计模式
Java基础-Java中23种设计模式之常用的设计模式 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.设计模式分类 设计模式是针对特定场景给出的专家级的解决方案.总的来说设 ...
- Java基础复习笔记系列 五 常用类
Java基础复习笔记系列之 常用类 1.String类介绍. 首先看类所属的包:java.lang.String类. 再看它的构造方法: 2. String s1 = “hello”: String ...
- Java基础-Eclipse第三方安装包管理工具之Maven
Java基础-Eclipse第三方安装包管理工具之Maven 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 玩过Linux的小伙伴应该都知道yum吧,我们只要把搭建好的yum仓库配 ...
- Java程序员常用工具类库
有人说当你开始学习Java的时候,你就走上了一条不归路,在Java世界里,包罗万象,从J2SE,J2ME,J2EE三大平台,到J2EE中的13中核心技术,再到Java世界中万紫千红的Framework ...
- java基础---->java中正则表达式二
跟正则表达式相关的类有:Pattern.Matcher和String.今天我们就开始Java中正则表达式的学习. Pattern和Matcher的理解 一.正则表达式的使用方法 一般推荐使用的方式如下 ...
- Java基础-Java中的堆内存和离堆内存机制
Java基础-Java中的堆内存和离堆内存机制 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任.
随机推荐
- springboot的最简创建方式
springboot是目前比较流行的技术栈之一,我在这里写一个springboot工程最简方式 首先开发工具是IDEA,双击打开IDEA,点击Create new Project 进入到这个页面,选择 ...
- CentOS 7.3 安装 libsodium 1.0.18
出现configure: error: The Sodium crypto library libraries not found.错误或者notfound 1.下载并解压 wget https:// ...
- MapReduce应用案例
1 环境说明 注意:本实验是对前述实验的延续,如果直接点开始实验进入则需要按先前学习的方法启动hadoop 部署节点操作系统为CentOS,防火墙和SElinux禁用,创建了一个shiyanlou用户 ...
- composer 依赖的require安装与remove删除命令
安装:require composer require phpmailer/phpmailer 删除:remove composer remove phpmailer/phpmailer
- Nginx 的三大功能
1.HTTP服务器 Nginx是一个HTTP服务器,可以将服务器上的静态文件(如HTML.图片)通过HTTP协议展现给客户端. 2.反向代理服务器 Nginx也是反向代理服务器. 说反向代理之前先说一 ...
- linux语句速查
一.netstat -a或--all:显示所有连线中的Socket -A<网络类型>或--<网络类型>:列出该网络类型连线中的相关地址 -c或--continuous:持续列出 ...
- TensorFlow2.0(二):数学运算
1 基本运算:加(+).减(-).点乘(*).除(/).地板除法(//).取余(%) 基本运算中所有实例都以下面的张量a.b为例进行: >>> a = tf.random.unifo ...
- 使用SpringDataRedis的入门
在使用ssm框架下,我们会到redis做缓存. 1> 第一步,导包. <!-- Redis客户端 --> <dependency> <groupId>redi ...
- PHPSTORM 2019 激活
1.获取激活码 请自行百度 2.输入激活码 3.配置本地hosts 添加配置如下 0.0.0.0 account.jetbrains.com 0.0.0.0 www.jetbrains.com
- Gradle 梳理:安装、入门使用方法
Gradle 教程:第一部分,安装[翻译] 原文地址:http://rominirani.com/2014/07/28/gradle-tutorial-part-1-installation-se ...