Package com.backblaze.b2.util
Class B2Sha1InputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.backblaze.b2.util.B2Sha1InputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class B2Sha1InputStream extends java.io.InputStreamWrapper for an InputStream that computes the SHA1 of the bytes going through it.
-
-
Constructor Summary
Constructors Constructor Description B2Sha1InputStream(java.io.InputStream in)Initializes a stream that will digest all of the bytes read and skipped.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()byte[]digest()Returns the SHA1 of the bytes processed so far.java.lang.StringhexDigest()Returns the SHA1 if the bytes processed so far, as a hex string.intread()intread(byte[] buffer, int offset, int length)longskip(long bytesToSkip)
-
-
-
Method Detail
-
digest
public byte[] digest()
Returns the SHA1 of the bytes processed so far.
-
hexDigest
public java.lang.String hexDigest()
Returns the SHA1 if the bytes processed so far, as a hex string.
-
available
public int available() throws java.io.IOException- Overrides:
availablein 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
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] buffer, int offset, int length) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
skip
public long skip(long bytesToSkip) throws java.io.IOException- Overrides:
skipin classjava.io.InputStream- Throws:
java.io.IOException
-
-