Class HashingOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
com.google.common.hash.HashingOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
An
OutputStream
that maintains a hash of the data written to it.- Since:
- 16.0
- Author:
- Zoe Piepmeier
-
Field Summary
Fields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
ConstructorDescriptionHashingOutputStream
(HashFunction hashFunction, OutputStream out) Creates an output stream that hashes using the givenHashFunction
, and forwards all data written to it to the underlyingOutputStream
. -
Method Summary
Methods inherited from class java.io.FilterOutputStream
flush, write
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
HashingOutputStream
Creates an output stream that hashes using the givenHashFunction
, and forwards all data written to it to the underlyingOutputStream
.The
OutputStream
should not be written to before or after the hand-off.
-
-
Method Details
-
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
hash
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
-