org.apache.james.jdkim.canon
Class DigestOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by org.apache.james.jdkim.canon.DigestOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class DigestOutputStream
extends FilterOutputStream

DigestOutputStream is used as a filter stream or as the ending stream in order to calculate a digest of a stream.


Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
DigestOutputStream(MessageDigest md)
           
DigestOutputStream(MessageDigest md, OutputStream out)
           
 
Method Summary
 void close()
           
 void flush()
           
 byte[] getDigest()
           
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int arg0)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DigestOutputStream

public DigestOutputStream(MessageDigest md)

DigestOutputStream

public DigestOutputStream(MessageDigest md,
                          OutputStream out)
Method Detail

write

public void write(int arg0)
           throws IOException
Overrides:
write in class FilterOutputStream
Throws:
IOException

write

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

close

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

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Overrides:
flush in class FilterOutputStream
Throws:
IOException

write

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

getDigest

public byte[] getDigest()
Returns:
the stream digest as a byte array


Copyright © 2008-2009 The Apache Software Foundation. All Rights Reserved.