Class MacOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.tapestry5.internal.util.MacOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class MacOutputStream extends OutputStream
An output stream that wraps around aMac
(message authentication code algorithm). This is currently used for symmetric (private) keys, but in theory could be used with assymetric (public/private) keys.- Since:
- 5.3.6
-
-
Constructor Summary
Constructors Constructor Description MacOutputStream(Mac mac)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getResult()
Should only be invoked once, immediately after this stream is closed; it generates the final MAC result, and returns it as a Base64 encoded string.static MacOutputStream
streamFor(Key key)
void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)
-
Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream
-
-
-
-
Constructor Detail
-
MacOutputStream
public MacOutputStream(Mac mac)
-
-
Method Detail
-
streamFor
public static MacOutputStream streamFor(Key key) throws IOException
- Throws:
IOException
-
getResult
public String getResult()
Should only be invoked once, immediately after this stream is closed; it generates the final MAC result, and returns it as a Base64 encoded string.- Returns:
- Base64 encoded MAC result
-
write
public void write(int b) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] b) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
-