1 17 package com.sun.org.apache.xml.internal.security.utils; 18 19 import java.io.ByteArrayOutputStream ; 20 21 import com.sun.org.apache.xml.internal.security.algorithms.MessageDigestAlgorithm; 22 23 27 public class DigesterOutputStream extends ByteArrayOutputStream { 28 final static byte none[]="error".getBytes(); 29 final MessageDigestAlgorithm mda; 30 33 public DigesterOutputStream(MessageDigestAlgorithm mda) { 34 this.mda=mda; 35 } 36 37 38 public byte[] toByteArray() { 39 return none; 40 } 41 42 43 public void write(byte[] arg0) { 44 mda.update(arg0); 45 } 46 47 48 public void write(int arg0) { 49 mda.update((byte)arg0); 50 } 51 52 53 public void write(byte[] arg0, int arg1, int arg2) { 54 mda.update(arg0, arg1, arg2); 55 } 56 57 60 public byte[] getDigestValue() { 61 return mda.digest(); 62 } 63 } 64 | Popular Tags |