EasyDigestOutputStreampublic 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 void | close()
out.close();
result = digest.digest();
closed = true;
| public byte[] | getDigest()
return result;
| public void | on(boolean on)
this.on = on;
| public void | write(int b)
if (on) digest.update((byte)b);
out.write(b);
| public void | write(byte[] data, int offset, int length)
if (on) digest.update(data, offset, length);
out.write(data, offset, length);
|
|