diff -r 000000000000 -r 716af5f2ebd1 samples/messagedigest/src-new-spi/org/apidesign/spi/security/Digestor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/messagedigest/src-new-spi/org/apidesign/spi/security/Digestor.java Sat Jun 14 09:52:23 2008 +0200 @@ -0,0 +1,40 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package org.apidesign.spi.security; + +import org.apidesign.impl.security.spi.DigestorAccessor; +import java.nio.ByteBuffer; + +/** + * + * @author Jaroslav Tulach + */ +// BEGIN: day.end.bridges.Digestor +public abstract class Digestor { + protected abstract byte[] digest(Data data); + protected abstract Data create(String algorithm); + protected abstract void update(Data data, ByteBuffer input); + +// END: day.end.bridges.Digestor + static { + new DigestorAccessor() { + @Override + protected byte[] digest(Digestor dig, Data data) { + return dig.digest(data); + } + + @Override + protected Data create(Digestor dig, String algorithm) { + return dig.create(algorithm); + } + + @Override + protected void update(Digestor dig, Data data, ByteBuffer input) { + dig.update(data, input); + } + }; + } +}