|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.OutputStream
net.rim.device.api.crypto.CryptoOutputStream
net.rim.device.api.crypto.MACOutputStream
public class MACOutputStream
The MACOutputStream class provides streaming functionality with
a Message Authentication Code MAC
by allowing for write calls to an underlying output stream
and passing this information through the MAC as it is being
written.
MACInputStream| Field Summary | ||
|---|---|---|
|
protected MAC |
_mac
Stores that MAC for later use. |
|
protected boolean |
_on
Determines whether or not information that is written to the output stream should be passed through the MAC beforehand. |
| Fields inherited from class net.rim.device.api.crypto.CryptoOutputStream |
|---|
_out |
| Constructor Summary | ||
|---|---|---|
|
MACOutputStream(MAC mac,
OutputStream out)
Creates a MACOutputStream object using a MAC that the user wants
and an output stream that all data will be written to. |
|
| Method Summary | ||
|---|---|---|
|
String |
getAlgorithm()
Returns the name of this algorithm, eg "HMAC". |
|
MAC |
getMAC()
Returns a reference to the MAC object 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. |
|
void |
write(byte[] buffer,
int offset,
int length)
Writes a specified length of bytes from the given byte array to this output stream. |
| Methods inherited from class net.rim.device.api.crypto.CryptoOutputStream |
|---|
close, flush, getOutputStream, write, write |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected MAC _mac
protected boolean _on
| Constructor Detail |
|---|
public MACOutputStream(MAC mac,
OutputStream out)
MACOutputStream object using a MAC that the user wants
and an output stream that all data will be written to.
mac - The MAC object to use with this output stream.out - The underlying output stream that all data.
will be written to. If this is null, no output stream will be used,
allowing just the MAC features to be used.| Method Detail |
|---|
public String getAlgorithm()
getAlgorithm in class CryptoOutputStreampublic void on(boolean on)
Note that _on is set to true by default.
on - A boolean stating whether the MAC is on (true) or off (false).
public void write(byte[] buffer,
int offset,
int length)
throws IOException
CryptoOutputStream
write in class CryptoOutputStreambuffer - The byte array containing the bytes that are
going to be written to the output stream.offset - The offset in the byte array where the method
will start writing from.length - The number of bytes that will be written to
the output stream.
IOException - Thrown if an I/O error occurs.public MAC getMAC()
MAC object 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