Package org.apache.jcp.xml.dsig.internal
Class DigesterOutputStream
java.lang.Object
java.io.OutputStream
org.apache.jcp.xml.dsig.internal.DigesterOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate UnsyncByteArrayOutputStream
private final boolean
private static final org.slf4j.Logger
private final MessageDigest
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a DigesterOutputStream.DigesterOutputStream
(MessageDigest md, boolean buffer) Creates a DigesterOutputStream. -
Method Summary
Methods inherited from class java.io.OutputStream
flush, nullOutputStream, write
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
buffer
private final boolean buffer -
bos
-
md
-
-
Constructor Details
-
DigesterOutputStream
Creates a DigesterOutputStream.- Parameters:
md
- the MessageDigest
-
DigesterOutputStream
Creates a DigesterOutputStream.- Parameters:
md
- the MessageDigestbuffer
- if true, caches the input bytes
-
-
Method Details
-
write
public void write(int input) - Specified by:
write
in classOutputStream
-
write
public void write(byte[] input, int offset, int len) - Overrides:
write
in classOutputStream
-
getDigestValue
public byte[] getDigestValue()- Returns:
- the digest value
-
getInputStream
- Returns:
- an input stream containing the cached bytes, or null if not cached
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-