Package org.aoju.bus.core.io
Class HashSource
java.lang.Object
org.aoju.bus.core.io.DelegateSource
org.aoju.bus.core.io.HashSource
- All Implemented Interfaces:
Closeable,AutoCloseable,Source
计算其提供的全部字节流的散列的源 若要使用,请创建
使用您首选的哈希算法实例 通过读取源文件的所有字节来耗尽源文件
然后调用
hash()来计算最终的哈希值- Since:
- Java 17+
- Author:
- Kimi Liu
-
Method Summary
Modifier and TypeMethodDescriptionfinal ByteStringhash()static HashSourcehmacSha1(Source source, ByteString key) static HashSourcehmacSha256(Source source, ByteString key) static HashSourcelong从中删除至少1个字节,最多为byteCount字节, 并将它们 附加到sink。返回读取的字节数,如果该源已耗尽,则返回-1static HashSourcestatic HashSourceMethods inherited from class org.aoju.bus.core.io.DelegateSource
close, delegate, timeout, toString
-
Method Details
-
md5
-
sha1
-
sha256
-
hmacSha1
-
hmacSha256
-
read
Description copied from interface:Source从中删除至少1个字节,最多为byteCount字节, 并将它们 附加到sink。返回读取的字节数,如果该源已耗尽,则返回-1- Specified by:
readin interfaceSource- Overrides:
readin classDelegateSource- Parameters:
sink- 缓冲byteCount- 长度大小- Returns:
- the long
- Throws:
IOException-IOExceptionIOException.
-
hash
-