samples/messagedigest/src-bridge/org/apidesign/impl/security/extension/BridgeToNew.java
Simplified to does not contain the friend API, instead the SPI is directly define by the API
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
6 package org.apidesign.impl.security.extension;
8 import java.nio.ByteBuffer;
9 import java.security.MessageDigest;
10 import java.security.NoSuchAlgorithmException;
11 import java.util.logging.Level;
12 import java.util.logging.Logger;
13 import org.apidesign.spi.security.Digestor;
17 * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
19 // BEGIN: day.end.bridges.BridgeToNew
20 public class BridgeToNew extends Digestor<MessageDigest> {
22 protected MessageDigest create(String algorithm) {
24 return MessageDigest.getInstance(algorithm);
25 } catch (NoSuchAlgorithmException ex) {
26 Logger.getLogger(BridgeToNew.class.getName()).log(Level.FINE, "Cannot find " + algorithm, ex);
32 protected byte[] digest(MessageDigest data) {
37 protected void update(MessageDigest data, ByteBuffer input) {
41 // END: day.end.bridges.BridgeToNew