Package org.bouncycastle.jcajce.io
Class MacOutputStream
- java.lang.Object
 - 
- java.io.OutputStream
 - 
- org.bouncycastle.jcajce.io.MacOutputStream
 
 
 
- 
- All Implemented Interfaces:
 java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public final class MacOutputStream extends java.io.OutputStreamAn output stream which calculates a MAC based on the data that is written to it. 
- 
- 
Constructor Summary
Constructors Constructor Description MacOutputStream(javax.crypto.Mac mac)Base constructor - specify the MAC algorithm to use. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getMac()Execute doFinal() and return the calculated MAC.voidwrite(byte[] bytes, int off, int len)Write a block of data of length len starting at offset off in the byte array bytes to the stream.voidwrite(int b)Write a single byte to the stream. 
 - 
 
- 
- 
Method Detail
- 
write
public void write(int b) throws java.io.IOExceptionWrite a single byte to the stream.- Specified by:
 writein classjava.io.OutputStream- Parameters:
 b- the byte value to write.- Throws:
 java.io.IOException- in case of failure.
 
- 
write
public void write(byte[] bytes, int off, int len) throws java.io.IOExceptionWrite a block of data of length len starting at offset off in the byte array bytes to the stream.- Overrides:
 writein classjava.io.OutputStream- Parameters:
 bytes- byte array holding the data.off- offset into bytes that the data starts at.len- the length of the data block to write.- Throws:
 java.io.IOException- in case of failure.
 
- 
getMac
public byte[] getMac()
Execute doFinal() and return the calculated MAC.- Returns:
 - the MAC calculated from the output written to the stream.
 
 
 - 
 
 -