|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
net.rim.device.api.crypto.CryptoInputStream
net.rim.device.api.crypto.MACInputStream
public class MACInputStream
Provides streaming functionality with a MAC by allowing for read calls to an underlying input stream and passing this information through the MAC as it is being read.
MACOutputStream| Field Summary | ||
|---|---|---|
|
protected MAC |
_mac
Stores that MAC for later use. |
|
protected boolean |
_on
A boolean that determines if information that is read from the input stream should be passed through the MAC before being returned to the user. |
| Fields inherited from class net.rim.device.api.crypto.CryptoInputStream |
|---|
_inputStream |
| Constructor Summary | ||
|---|---|---|
|
MACInputStream(MAC mac,
InputStream inputStream)
Creates a MACInputStream object with the specified MAC
and an input stream that will contain the data to be read. |
|
| Method Summary | ||
|---|---|---|
|
String |
getAlgorithm()
Returns the name of this algorithm, eg "HMAC". |
|
MAC |
getMAC()
Returns a reference to the MAC being used in this instance of the
class. |
|
void |
on(boolean on)
Allows the programmer to turn the MAC functionality of the stream on or off at will. |
|
int |
read(byte[] data,
int offset,
int length)
Reads up to the specified number of bytes from this input stream into an array of bytes. |
| Methods inherited from class net.rim.device.api.crypto.CryptoInputStream |
|---|
available, close, getInputStream, markSupported, read, read |
| Methods inherited from class java.io.InputStream |
|---|
mark, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected MAC _mac
protected boolean _on
Note: By default _on is set to true.
| Constructor Detail |
|---|
public MACInputStream(MAC mac,
InputStream inputStream)
MACInputStream object with the specified MAC
and an input stream that will contain the data to be read.
mac - The MAC object to use with this input stream.inputStream - The underlying inputStream object that all data
will be read from.| Method Detail |
|---|
public String getAlgorithm()
getAlgorithm in class CryptoInputStreampublic void on(boolean on)
Note that _on is true by default.
on - A boolean stating whether the MAC is on (true) or off (false).
public int read(byte[] data,
int offset,
int length)
throws IOException
CryptoInputStream
read in class CryptoInputStreamdata - The buffer into which the data is read.offset - The starting offset within the buffer, to store the data.length - The maximum number of bytes to read.
IOException - Thrown if an I/O error occurs.InputStream.read()public MAC getMAC()
MAC being used in this instance of the
class.
MAC object.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal