org.apache.tapestry5.internal.util
Class MacOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.tapestry5.internal.util.MacOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class MacOutputStream
extends OutputStream

An output stream that wraps around a Mac (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
MacOutputStream(Mac mac)
           
 
Method Summary
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 class OutputStream
Throws:
IOException

write

public void write(byte[] b)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException


Copyright © 2003-2012 The Apache Software Foundation.