类 GzipUtils
java.lang.Object
com.dtflys.forest.utils.GzipUtils
GZIP工具类
- 从以下版本开始:
- 1.5.1
- 作者:
- gongjun[jun.gong@thebeastshop.com]
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static byte[]compressGzip(byte[] bytes) 压缩字节数组数据static byte[]compressGzip(String text) 压缩字符串数据static byte[]compressGzip(String text, Charset charset) 压缩字符串数据static GZIPInputStream将InputStream转换为GZIPInputStreamstatic byte[]将GZIP输入流解压为字节数组static byte[]将GZIP输入流解压为字节数组static StringdecompressGzipToString(byte[] bytes, String encoding) 将GZIP输入流解压为字符串static StringdecompressGzipToString(InputStream in, String encoding) 将GZIP输入流解压为字符串static StringdecompressGzipToString(GZIPInputStream gzipIn, String encoding) 将GZIP输入流解压为字符串static boolean判断是否为gzip
-
构造器详细资料
-
GzipUtils
public GzipUtils()
-
-
方法详细资料
-
isGzip
判断是否为gzip根据Response传回的Content-Encoding来判断是否为gzip压缩的内容
- 参数:
contentEncoding- 内容编码- 返回:
true为gzip压缩内容, 否则不是
-
compressGzip
public static byte[] compressGzip(byte[] bytes) 压缩字节数组数据- 参数:
bytes- 字节数组数据- 返回:
- 压缩过的字节数组
-
compressGzip
压缩字符串数据- 参数:
text- 字符串数据charset- 字符集- 返回:
- 压缩过的字节数组
-
compressGzip
压缩字符串数据- 参数:
text- 字符串数据- 返回:
- 压缩过的字节数组
-
decompressGzipInputStream
将InputStream转换为GZIPInputStream- 参数:
in-InputStream实例- 返回:
GZIPInputStream实例- 抛出:
IOException- IO异常
-
decompressGzipToByteArray
将GZIP输入流解压为字节数组- 参数:
gzipIn-GZIPInputStream实例- 返回:
- 字节数组
- 抛出:
IOException- IO异常
-
decompressGzipToString
public static String decompressGzipToString(GZIPInputStream gzipIn, String encoding) throws IOException 将GZIP输入流解压为字符串- 参数:
gzipIn-GZIPInputStream实例encoding- 字符串编码- 返回:
- 字符串
- 抛出:
IOException- IO异常
-
decompressGzipToByteArray
将GZIP输入流解压为字节数组- 参数:
in-InputStream实例- 返回:
- 字节数组
- 抛出:
IOException- IO异常
-
decompressGzipToString
将GZIP输入流解压为字符串- 参数:
in-InputStream实例encoding- 字符串编码- 返回:
- 字符串
- 抛出:
IOException- IO异常
-
decompressGzipToString
将GZIP输入流解压为字符串- 参数:
bytes- 字节数组encoding- 字符串编码- 返回:
- 字符串
- 抛出:
IOException- IO异常
-