Package org.apache.iceberg.util
Class HashWriter
java.lang.Object
java.io.Writer
org.apache.iceberg.util.HashWriter
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
Writer implementation that uses a hashing function to produce a hash value based
on the streamed bytes. The output of the writer is not preserved.-
Constructor Details
-
HashWriter
- Throws:
NoSuchAlgorithmException
-
-
Method Details
-
write
- Specified by:
writein classWriter- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Specified by:
flushin classWriter- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- Throws:
IOException
-
getHash
public byte[] getHash()Calculates the final hash value. The underlying digest will be reset thus subsequent getHash() calls are not permitted.- Returns:
- bytes of final hash value
-