public class MacInputStream
extends java.io.FilterInputStream
| Modifier and Type | Field and Description |
|---|---|
protected javax.crypto.Mac |
mac |
| Constructor and Description |
|---|
MacInputStream(java.io.InputStream stream,
javax.crypto.Mac mac)
The Constructor for the MacInputStream.
|
| Modifier and Type | Method and Description |
|---|---|
javax.crypto.Mac |
getMac() |
int |
read()
Reads a single byte from the Stream and updates the Mac
calculation based on the byte read.
|
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from the input stream into an array of bytes and updates the
Mac calculation based on the bytes read.
|
public MacInputStream(java.io.InputStream stream,
javax.crypto.Mac mac)
stream - the InputStream to be wrappedmac - The Mac algorithm to usepublic int read()
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
An attempt is made to read as many as len bytes, but a smaller number may be read. The number of bytes actually read is returned as an integer. This method blocks until input data is available, end of file is detected, or an exception is thrown.
Parameters:
read in class java.io.FilterInputStreamb - the buffer into which the data is read.off - the start offset in array b at which the data is written.len - the maximum number of bytes to read.java.io.IOExceptionpublic javax.crypto.Mac getMac()