com.baidubce.util
Class MD5DigestCalculatingInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by com.baidubce.util.MD5DigestCalculatingInputStream
All Implemented Interfaces:
Closeable

public class MD5DigestCalculatingInputStream
extends FilterInputStream

Simple InputStream wrapper that examines the wrapped stream's contents as they are read and calculates and MD5 digest.


Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
MD5DigestCalculatingInputStream(InputStream in)
           
 
Method Summary
 byte[] getMd5Digest()
           
 int read()
           
 int read(byte[] b, int off, int len)
           
 void reset()
          Resets the wrapped input stream and the in progress message digest.
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MD5DigestCalculatingInputStream

public MD5DigestCalculatingInputStream(InputStream in)
                                throws NoSuchAlgorithmException
Throws:
NoSuchAlgorithmException
Method Detail

getMd5Digest

public byte[] getMd5Digest()

reset

public void reset()
           throws IOException
Resets the wrapped input stream and the in progress message digest.

Overrides:
reset in class FilterInputStream
Throws:
IOException
See Also:
InputStream.reset()

read

public int read()
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException
See Also:
InputStream.read()

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException
See Also:
InputStream.read(byte[], int, int)


Copyright © 2018. All rights reserved.