Top Description Fields Constructors Methods
org.bouncycastle.jcajce.io

public final Class MacOutputStream

extends OutputStream
Class Inheritance
Imports
java.io.IOException, .OutputStream, javax.crypto.Mac

An output stream which calculates a MAC based on the data that is written to it.

Field Summary

Modifier and TypeField and Description
private Mac

Constructor Summary

AccessConstructor and Description
public
MacOutputStream(Mac
the MAC implementation to use as the basis of the stream.
mac
)

Base constructor - specify the MAC algorithm to use.

Method Summary

Modifier and TypeMethod and Description
public byte[]

Returns:

the MAC calculated from the output written to the stream.
getMac
()

Execute doFinal() and return the calculated MAC.

public void
write(int
the byte value to write.
b
)

Implements abstract java.io.OutputStream.write.

Write a single byte to the stream.
public void
write(byte[]
byte array holding the data.
bytes
,
int
offset into bytes that the data starts at.
off
,
int
the length of the data block to write.
len
)

Overrides java.io.OutputStream.write.

Write a block of data of length len starting at offset off in the byte array bytes to the stream.
Inherited from java.io.OutputStream:
closeflushnullOutputStreamwrite

Field Detail

macback to summary
private Mac mac

Constructor Detail

MacOutputStreamback to summary
public MacOutputStream(Mac mac)

Base constructor - specify the MAC algorithm to use.

Parameters
mac:Mac

the MAC implementation to use as the basis of the stream.

Method Detail

getMacback to summary
public byte[] getMac()

Execute doFinal() and return the calculated MAC.

Returns:byte[]

the MAC calculated from the output written to the stream.

writeback to summary
public void write(int b) throws IOException

Implements abstract java.io.OutputStream.write.

Write a single byte to the stream.

Parameters
b:int

the byte value to write.

Exceptions
IOException:
in case of failure.
writeback to summary
public void write(byte[] bytes, int off, int len) throws IOException

Overrides java.io.OutputStream.write.

Write a block of data of length len starting at offset off in the byte array bytes to the stream.

Parameters
bytes:byte[]

byte array holding the data.

off:int

offset into bytes that the data starts at.

len:int

the length of the data block to write.

Exceptions
IOException:
in case of failure.