org.apache.jcp.xml.dsig.internal
Class DigesterOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.apache.jcp.xml.dsig.internal.DigesterOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class DigesterOutputStream
extends OutputStream

This class has been modified slightly to use java.security.MessageDigest objects as input, rather than org.apache.xml.security.algorithms.MessageDigestAlgorithm objects. It also optionally caches the input bytes.

Author:
raul, Sean Mullan

Constructor Summary
DigesterOutputStream(MessageDigest md)
          Creates a DigesterOutputStream.
DigesterOutputStream(MessageDigest md, boolean buffer)
          Creates a DigesterOutputStream.
 
Method Summary
 void close()
           
 byte[] getDigestValue()
           
 InputStream getInputStream()
           
 void write(byte[] input, int offset, int len)
           
 void write(int input)
           
 
Methods inherited from class java.io.OutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DigesterOutputStream

public DigesterOutputStream(MessageDigest md)
Creates a DigesterOutputStream.

Parameters:
md - the MessageDigest

DigesterOutputStream

public DigesterOutputStream(MessageDigest md,
                            boolean buffer)
Creates a DigesterOutputStream.

Parameters:
md - the MessageDigest
buffer - if true, caches the input bytes
Method Detail

write

public void write(int input)
Specified by:
write in class OutputStream

write

public void write(byte[] input,
                  int offset,
                  int len)
Overrides:
write in class OutputStream

getDigestValue

public byte[] getDigestValue()
Returns:
the digest value

getInputStream

public InputStream getInputStream()
Returns:
an input stream containing the cached bytes, or null if not cached

close

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


Copyright © 2000–2014 The Apache Software Foundation. All rights reserved.