org.modeshape.common.util
Class SecureHash.HashingInputStream
java.lang.Object
java.io.InputStream
org.modeshape.common.util.SecureHash.HashingInputStream
- All Implemented Interfaces:
- Closeable
- Enclosing class:
- SecureHash
public static class SecureHash.HashingInputStream
- extends InputStream
Method Summary |
void |
close()
|
byte[] |
getHash()
Get the hash of the content read by this stream. |
String |
getHashAsHexString()
Get the string representation of the binary hash of the content read by this stream. |
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] b,
int off,
int len)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SecureHash.HashingInputStream
protected SecureHash.HashingInputStream(MessageDigest digest,
InputStream input)
read
public int read()
throws IOException
-
- Specified by:
read
in class InputStream
- Throws:
IOException
- See Also:
InputStream.read()
read
public int read(byte[] b,
int off,
int len)
throws IOException
-
- Overrides:
read
in class InputStream
- Throws:
IOException
- See Also:
InputStream.read(byte[], int, int)
read
public int read(byte[] b)
throws IOException
-
- Overrides:
read
in class InputStream
- Throws:
IOException
- See Also:
InputStream.read(byte[])
close
public void close()
throws IOException
-
- Specified by:
close
in interface Closeable
- Overrides:
close
in class InputStream
- Throws:
IOException
- See Also:
InputStream.close()
getHash
public byte[] getHash()
- Get the hash of the content read by this stream. This method will return null if the stream has not yet been closed.
- Returns:
- the hash of the contents as a byte array, or null if the stream has not yet been closed
getHashAsHexString
public String getHashAsHexString()
- Get the string representation of the binary hash of the content read by this stream. This method will return null if
the stream has not yet been closed.
- Returns:
- the hex-encoded representation of the binary hash of the contents, or null if the stream has not yet been
closed
Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.