com.croftsoft.core.util.cache.secure
Class SecureInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
com.croftsoft.core.util.cache.secure.SecureInputStream
- All Implemented Interfaces:
- Closeable
public class SecureInputStream
- extends FilterInputStream
A FilterInputStream which will throw a SecurityException if the
stream content does not have the digest expected.
- Version:
- 1999-04-13
- See Also:
DigestInputStream
,
MessageDigest
- Author:
- David Wallace Croft
Method Summary |
int |
read()
|
int |
read(byte[] byteArray,
int offset,
int length)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SecureInputStream
public SecureInputStream(InputStream inputStream,
String algorithm,
byte[] digest)
throws NoSuchAlgorithmException
- Parameters:
algorithm
- The MessageDigest algorithm to use.digest
- The expected digest.
- Throws:
NoSuchAlgorithmException
read
public int read()
throws IOException
- Overrides:
read
in class FilterInputStream
- Throws:
SecurityException
- If the end of the stream is reached and the digest is not what
is expected.
IOException
read
public int read(byte[] byteArray,
int offset,
int length)
throws IOException
- Overrides:
read
in class FilterInputStream
- Throws:
SecurityException
- If the end of the stream is reached and the digest is not what
is expected.
IOException
CroftSoft Core Javadoc (2008-09-28 20:58:02)