首页 > 其他 > 详细

Security类中的getImpl()方法

时间:2014-12-22 16:13:22      阅读:427      评论:0      收藏:0      [点我收藏+]

Security类中的getImpl方法源码:

Security.getImpl()方法返回的是一个对象数组。

数组的第一位是根据请求的算法以及类型对象的一个实例,

数组的第二位是对应算法提供者的唯一标识。其中provider的值可以为null类型,在这种情况下,将在provider配置文件中搜寻最优先的提供者。

以下是源码

/*

     * Returns an array of objects: the first object in the array is

     * an instance of an implementation of the requested algorithm
     * and type, and the second object in the array identifies the provider
     * of that implementation.
     * The <code>provider</code> argument can be null, in which case all
     * configured providers will be searched in order of preference.
     */
    static Object[] getImpl(String algorithm, String type, String provider)
            throws NoSuchAlgorithmException, NoSuchProviderException {
        if (provider == null) {
            return GetInstance.getInstance
                (type, getSpiClass(type), algorithm).toArray();
        } else {
            return GetInstance.getInstance
                (type, getSpiClass(type), algorithm, provider).toArray();
        }
    }

Security类中的getImpl()方法

原文:http://blog.csdn.net/u014682413/article/details/42080897

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!