org.kuali.rice.ksb.security
Class SignatureSigningOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by javax.servlet.ServletOutputStream
          extended by org.kuali.rice.ksb.security.SignatureSigningOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class SignatureSigningOutputStream
extends javax.servlet.ServletOutputStream

An OutputStream which decorates another OutputStream with a wrapper that digitally signs the data when the OutputStream is closed. Since this class does not know where the resulting digital signature will reside, a DigitalSigner will be invoked to execute the actual signing of the message (i.e. put it in a header).

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
private  BufferedOutputStream bufferedDataHoldingStream
           
private  ByteArrayOutputStream dataHoldingStream
           
private  boolean delayWrite
           
private  DigitalSigner signer
           
private  OutputStream wrappedOutputStream
           
 
Constructor Summary
SignatureSigningOutputStream(DigitalSigner signer, OutputStream wrappedOutputStream, boolean delayWrite)
          Constructs a SignatureSigningOutputStream with the given DigitalSigner and underlying OutputStream.
 
Method Summary
 void close()
           
 void write(int data)
           
 
Methods inherited from class javax.servlet.ServletOutputStream
print, print, print, print, print, print, print, println, println, println, println, println, println, println, println
 
Methods inherited from class java.io.OutputStream
flush, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delayWrite

private boolean delayWrite

signer

private DigitalSigner signer

bufferedDataHoldingStream

private BufferedOutputStream bufferedDataHoldingStream

dataHoldingStream

private ByteArrayOutputStream dataHoldingStream

wrappedOutputStream

private OutputStream wrappedOutputStream
Constructor Detail

SignatureSigningOutputStream

public SignatureSigningOutputStream(DigitalSigner signer,
                                    OutputStream wrappedOutputStream,
                                    boolean delayWrite)
Constructs a SignatureSigningOutputStream with the given DigitalSigner and underlying OutputStream. If true, the delayWrite boolean indicates that the stream should store all data internally until the stream is closed, at which point it should forward all data to the wrapped OutputStream. If delayWrite is false, then the data will be forwarded immediately.

Method Detail

write

public void write(int data)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.