public class Digester extends Object
| 构造器和说明 |
|---|
Digester(DigestAlgorithm algorithm) |
| 限定符和类型 | 方法和说明 |
|---|---|
byte[] |
digest(byte[] data)
生成摘要
|
byte[] |
digest(File file)
生成文件摘要
使用默认缓存大小 |
byte[] |
digest(InputStream data)
生成摘要,使用默认缓存大小
|
byte[] |
digest(InputStream data,
int bufferLength)
生成摘要
|
byte[] |
digest(String data)
生成文件摘要
|
byte[] |
digest(String data,
String charset)
生成文件摘要
|
String |
digestHex(byte[] data)
生成摘要,并转为16进制字符串
|
String |
digestHex(File file)
生成文件摘要,并转为16进制字符串
使用默认缓存大小 |
String |
digestHex(InputStream data)
生成摘要,并转为16进制字符串
使用默认缓存大小 |
String |
digestHex(InputStream data,
int bufferLength)
生成摘要,并转为16进制字符串
使用默认缓存大小 |
String |
digestHex(String data)
生成文件摘要
|
String |
digestHex(String data,
String charset)
生成文件摘要,并转为16进制字符串
|
MessageDigest |
getDigest()
|
Digester |
init(String algorithm)
初始化
|
public Digester(DigestAlgorithm algorithm)
public Digester init(String algorithm)
algorithm - 算法DigesterCryptoException - Cause by IOExceptionpublic byte[] digest(String data)
data - 被摘要数据public String digestHex(String data, String charset)
data - 被摘要数据charset - 编码public byte[] digest(File file)
file - 被摘要文件CryptoException - Cause by IOExceptionpublic byte[] digest(byte[] data)
data - 数据bytespublic String digestHex(byte[] data)
data - 被摘要数据public byte[] digest(InputStream data)
data - InputStream 数据流public String digestHex(InputStream data)
data - 被摘要数据public byte[] digest(InputStream data, int bufferLength)
data - InputStream 数据流bufferLength - 缓存长度,不足1使用 DEFAULT_BUFFER_SIZE 做为默认值public String digestHex(InputStream data, int bufferLength)
data - 被摘要数据bufferLength - 缓存长度,不足1使用 DEFAULT_BUFFER_SIZE 做为默认值public MessageDigest getDigest()
Copyright © 2017. All rights reserved.