samples/messagedigest/src-new-spi/org/apidesign/impl/security/spi/DigestorAccessor.java
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
6 package org.apidesign.impl.security.spi;
8 import java.nio.ByteBuffer;
9 import org.apidesign.spi.security.Digestor;
15 public abstract class DigestorAccessor {
16 private static DigestorAccessor INSTANCE;
18 protected DigestorAccessor() {
19 assert INSTANCE == null;
23 public static DigestorAccessor getDefault() {
25 Class.forName(Digestor.class.getName(), true, DigestorAccessor.class.getClassLoader());
27 } catch (ClassNotFoundException ex) {
28 throw new IllegalStateException(ex);
32 protected abstract <Data> byte[] digest(Digestor<Data> dig, Data data);
33 protected abstract <Data> Data create(Digestor<Data> dig, String algorithm);
34 protected abstract <Data> void update(Digestor<Data> dig, Data data, ByteBuffer input);