# 功能描述

实现html文本提取及生成二维码等功能。

# HtmlUtil提取纯文本

# 第一步 引入包

<dependency>
    <groupId>sei-cloud</groupId>
    <artifactId>tools</artifactId>
</dependency>
1
2
3
4

# 第二步 调用

public class HtmlUtil {
    /**
     * 从html中获取指定长度的纯文本内容
     * @param html:html
     * @param length:长度,小于0则提取所有文本
     * @return String
     * @throws ParserException 异常
     */
    public static String getTextFromHtml(String html,int length)throws ParserException;
}

1
2
3
4
5
6
7
8
9
10
11

# QRCodeUtil二维码

# 第一步 引入包

<dependency>
    <groupId>sei-cloud</groupId>
    <artifactId>tools</artifactId>
</dependency>
1
2
3
4

# 第二步 调用

/**
 * 生成二维码
 */
public class QRCodeUtil {

    /**
     * 读取二维码
     * @param inputStream: 二维码图片流
     * @return 读取的字符串
     * @throws IOException 异常
     * @throws NotFoundException 异常
     * @throws ChecksumException 异常
     * @throws FormatException 异常
     */
    public static String decode(InputStream inputStream) throws IOException, NotFoundException, ChecksumException, FormatException;

    /**
     * 解析二维码
     * @param file: 二维码图片
     * @return String
     * @throws IOException 异常
     * @throws NotFoundException 异常
     */
    public static String decode(File file) throws IOException, NotFoundException;

    /**
     * 基于 QRCode 生成二维码
     * @param content: 内容
     * @param width: 图片宽度
     * @param height: 图片高度
     * @param logoPath: 添加图标路径
     * @param backgroundColor: 背景色
     * @param color: 前景色
     * @param errorCorrectionLevel: 二维码的容错能力等级
     * @param version: 版本
     * @return BufferedImage
     * @throws IOException 异常
     * @throws WriterException 异常
     */
    public static BufferedImage encode(String content, int width, int height, String logoPath, Color color, Color backgroundColor, ErrorCorrectionLevel errorCorrectionLevel, Version version) throws IOException, WriterException;

    /**
     *
     * @param pathFileName: 文件存储绝对路径及文件名
     * @param format: 文件格式, 默认为jpg
     * @param content: 内容
     * @param width: 图片宽度
     * @param height: 图片高度
     * @param logoPath: 添加图标路径
     * @param backgroundColor: 背景色
     * @param color: 前景色
     * @param errorCorrectionLevel: 二维码的容错能力等级
     * @param version: 版本
     * @throws IOException 异常
     * @throws WriterException 异常
     */
    public static void encode(String pathFileName, String format, String content,int width, int height, String logoPath,  Color color,Color backgroundColor, ErrorCorrectionLevel errorCorrectionLevel, Version version) throws IOException, WriterException;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58