Hutool

前言

  • Hutool 是一款超级强力的工具类,大大提高工作效率。

  • 在大家日常工作中,都常常会做如下这些非常繁琐的工作

    • 日期与字符串转换
    • 文件操作
    • 转码与反转码
    • 随机数生成
    • 压缩与解压
    • 编码与解码
    • CVS 文件操作
    • 缓存处理
    • 加密解密
    • 定时任务
    • 邮件收发
    • 二维码创建
    • FTP 上传与下载
    • 图形验证码生成

    • 等等等等

  • 以上这些事情,要么自己动手写代码,要么从零零碎碎的各个不同的地方去找各种零零散散的代码来改造成自己需要的样子。

  • 现在不用了,您只需要一个 hutool ! 那么这些功能都是现成的了,而且非常好用。

  • Hutool 快速入门

1、使用

  • 导入 hutool 包

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    <project xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>cn.how2j</groupId>
    <artifactId>hutool</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>hutool</name>
    <description>hutool</description>

    <dependencies>
    <dependency>
    <groupId>cn.hutool</groupId>
    <artifactId>hutool-all</artifactId>
    <version>4.3.1</version>
    </dependency>
    </dependencies>

    </project>
  • 运行测试

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    import java.util.Date;

    import cn.hutool.core.date.DateUtil;

    public class TestHutool {

    public static void main(String[] args) {
    String dateStr = "2012-12-12 12:12:12";
    Date date = DateUtil.parse(dateStr);
    System.out.println(date);
    }
    }

2、编码工具

3、常用类辅助工具

4、类和对象

5、系统工具

6、和文件有关的

7、需要第三方的

8、其他

文章目录
  1. 1. 前言
  2. 2. 1、使用
  3. 3. 2、编码工具
  4. 4. 3、常用类辅助工具
  5. 5. 4、类和对象
  6. 6. 5、系统工具
  7. 7. 6、和文件有关的
  8. 8. 7、需要第三方的
  9. 9. 8、其他
隐藏目录