Package com.ibm.fhir.bucket.scanner
Class Sha256InputStreamDecorator
- java.lang.Object
 - 
- java.io.InputStream
 - 
- com.ibm.fhir.bucket.scanner.Sha256InputStreamDecorator
 
 
 
- 
- All Implemented Interfaces:
 java.io.Closeable,java.lang.AutoCloseable
public class Sha256InputStreamDecorator extends java.io.InputStreamDecorates an InputStream with the ability to compute a SHA-256 hash of the bytes read from the stream. Assumes that the entire stream is read. If buffering is done further up-stream, then obviously the digest may not represent what was actually read by the consumer, because the buffer may read bytes from this stream than were actually consumed. Caveat emptor. 
- 
- 
Constructor Summary
Constructors Constructor Description Sha256InputStreamDecorator(java.io.InputStream delegate)Public Constructor 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.lang.StringgetBase64Hash()Compute the digest.intread()intread(byte[] b, int off, int len) 
 - 
 
- 
- 
Method Detail
- 
getBase64Hash
public java.lang.String getBase64Hash()
Compute the digest. Resets the state- Returns:
 
 
- 
read
public int read() throws java.io.IOException- Specified by:
 readin classjava.io.InputStream- Throws:
 java.io.IOException
 
- 
read
public int read(byte[] b, int off, int len) throws java.io.IOException- Overrides:
 readin classjava.io.InputStream- Throws:
 java.io.IOException
 
- 
close
public void close() throws java.io.IOException- Specified by:
 closein interfacejava.lang.AutoCloseable- Specified by:
 closein interfacejava.io.Closeable- Overrides:
 closein classjava.io.InputStream- Throws:
 java.io.IOException
 
 - 
 
 -