FileDocCategorySizeDatePackage
EasyDigestOutputStream.javaAPI DocExample1230Sun Mar 28 19:07:38 BST 1999com.macfaq.security

EasyDigestOutputStream

public class EasyDigestOutputStream extends FilterOutputStream

Fields Summary
private boolean
on
private boolean
closed
protected byte[]
result
protected MessageDigest
digest
Constructors Summary
public EasyDigestOutputStream(OutputStream out, String algorithm)


      
     
    super(out);
    digest = MessageDigest.getInstance(algorithm);
  
public EasyDigestOutputStream(OutputStream out, String algorithm, String provider)

    super(out);
    digest = MessageDigest.getInstance(algorithm, provider);
  
Methods Summary
public voidclose()

    out.close();
    result = digest.digest();
    closed = true;
  
public byte[]getDigest()

    return result;
  
public voidon(boolean on)

    this.on = on;
  
public voidwrite(int b)

    if (on) digest.update((byte)b);
    out.write(b);
  
public voidwrite(byte[] data, int offset, int length)

    if (on) digest.update(data, offset, length);
    out.write(data, offset, length);