public class CountingDigestOutputStream extends DigestOutputStream
DigestOutputStream that also keeps track of the total number of bytes written.digestout| Constructor and Description |
|---|
CountingDigestOutputStream(OutputStream outputStream)
Wraps the
outputStream. |
| Modifier and Type | Method and Description |
|---|---|
long |
getTotalBytes() |
BlobDescriptor |
toBlobDescriptor()
Builds a
BlobDescriptor with the hash and size of the bytes written. |
void |
write(byte[] data,
int offset,
int length) |
void |
write(int singleByte) |
getMessageDigest, on, setMessageDigest, toStringclose, flush, writepublic CountingDigestOutputStream(OutputStream outputStream)
outputStream.outputStream - the OutputStream to wrap.public BlobDescriptor toBlobDescriptor()
BlobDescriptor with the hash and size of the bytes written. The buffer resets
after this method is called, so this method should only be called once per BlobDescriptor.BlobDescriptor.public long getTotalBytes()
public void write(byte[] data,
int offset,
int length)
throws IOException
write in class DigestOutputStreamIOExceptionpublic void write(int singleByte)
throws IOException
write in class DigestOutputStreamIOExceptionCopyright © 2018. All rights reserved.