⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transformservice.java

📁 Mobile 应用程序使用 Java Micro Edition (Java ME) 平台
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	}        Service s = GetInstance.getService            ("TransformService", algorithm, provider);        String value = s.getAttribute("MechanismType");        if ((value == null && dom) || 	    (value != null && value.equals(mechanismType))) {            Instance instance = GetInstance.getInstance(s, null);            TransformService ts = (TransformService) instance.impl;            ts.algorithm = algorithm;            ts.mechanism = mechanismType;            ts.provider = instance.provider;            return ts;	}        throw new NoSuchAlgorithmException            (algorithm + " algorithm and " + mechanismType 		 + " mechanism not available");    }    /**     * Returns a <code>TransformService</code> that supports the specified      * algorithm URI (ex: {@link Transform#XPATH2}) and mechanism type      * (ex: DOM) as supplied by the specified provider. The specified provider      * must be registered in the security provider list.      *     * <p>Note that the list of registered providers may be retrieved via      * the {@link Security#getProviders() Security.getProviders()} method.     *     * @param algorithm the URI of the algorithm     * @param mechanismType the type of the XML processing mechanism and      *   representation     * @param provider the string name of the provider     * @return a new <code>TransformService</code>     * @throws NoSuchProviderException if the specified provider is not      *   registered in the security provider list     * @throws NullPointerException if <code>provider</code>,      *   <code>mechanismType</code>, or <code>algorithm</code> is      *   <code>null</code>     * @throws NoSuchAlgorithmException if a <code>TransformService</code>      *   implementation for the specified algorithm and mechanism type is not      *   available from the specified provider     * @see Provider     */    public static TransformService getInstance	(String algorithm, String mechanismType, String provider) 	throws NoSuchAlgorithmException, NoSuchProviderException {	if (mechanismType == null || algorithm == null || provider == null) {	    throw new NullPointerException();	} else if (provider.length() == 0) {	    throw new NoSuchProviderException();	}	boolean dom = false;	if (mechanismType.equals("DOM")) {	    dom = true;	}        Service s = GetInstance.getService            ("TransformService", algorithm, provider);        String value = s.getAttribute("MechanismType");        if ((value == null && dom) || 	    (value != null && value.equals(mechanismType))) {            Instance instance = GetInstance.getInstance(s, null);            TransformService ts = (TransformService) instance.impl;            ts.algorithm = algorithm;            ts.mechanism = mechanismType;            ts.provider = instance.provider;            return ts;	}        throw new NoSuchAlgorithmException            (algorithm + " algorithm and " + mechanismType 		 + " mechanism not available");    }    private static class MechanismMapEntry implements Map.Entry {	private final String mechanism;	private final String algorithm;	private final String key;	MechanismMapEntry(String algorithm, String mechanism) {	    this.algorithm = algorithm;	    this.mechanism = mechanism;	    this.key = "TransformService." + algorithm + " MechanismType";	}	public boolean equals(Object o) {	    if (!(o instanceof Map.Entry)) {		return false;	    }	    Map.Entry e = (Map.Entry) o;	    return (getKey()==null ? 		    e.getKey()==null : getKey().equals(e.getKey())) &&     		   (getValue()==null ?      		    e.getValue()==null : getValue().equals(e.getValue()));	}	public Object getKey() {	    return key;	}	public Object getValue() {	    return mechanism;	}	public Object setValue(Object value) {	    throw new UnsupportedOperationException();	}	public int hashCode() {	    return (getKey()==null ? 0 : getKey().hashCode()) ^     		   (getValue()==null ? 0 : getValue().hashCode());	}    }    /**     * Returns the mechanism type supported by this <code>TransformService</code>.     *     * @return the mechanism type     */    public final String getMechanismType() {	return mechanism;    }    /**     * Returns the URI of the algorithm supported by this     * <code>TransformService</code>.     *     * @return the algorithm URI     */    public final String getAlgorithm() {	return algorithm;    }    /**     * Returns the provider of this <code>TransformService</code>.     *     * @return the provider     */    public final Provider getProvider() {	return provider;    }    /**     * Initializes this <code>TransformService</code> with the specified      * parameters.     *     * <p>If the parameters exist in XML form, the      * {@link #init(XMLStructure, XMLCryptoContext)} method should be used to      * initialize the <code>TransformService</code>.     *     * @param params the algorithm parameters (may be <code>null</code> if      *   not required or optional)     * @throws InvalidAlgorithmParameterException if the specified parameters      *   are invalid for this algorithm     */    public abstract void init(TransformParameterSpec params)	throws InvalidAlgorithmParameterException;    /**     * Marshals the algorithm-specific parameters. If there are no parameters     * to be marshalled, this method returns without throwing an exception.     *     * @param parent a mechanism-specific structure containing the parent     *    node that the marshalled parameters should be appended to     * @param context the <code>XMLCryptoContext</code> containing     *    additional context (may be <code>null</code> if not applicable)     * @throws ClassCastException if the type of <code>parent</code> or     *    <code>context</code> is not compatible with this     *    <code>TransformService</code>     * @throws NullPointerException if <code>parent</code> is <code>null</code>     * @throws MarshalException if the parameters cannot be marshalled     */    public abstract void marshalParams	(XMLStructure parent, XMLCryptoContext context)	throws MarshalException;    /**     * Initializes this <code>TransformService</code> with the specified      * parameters and document context.      *     * @param parent a mechanism-specific structure containing the parent     *    structure     * @param context the <code>XMLCryptoContext</code> containing     *    additional context (may be <code>null</code> if not applicable)     * @throws ClassCastException if the type of <code>parent</code> or     *    <code>context</code> is not compatible with this     *    <code>TransformService</code>     * @throws NullPointerException if <code>parent</code> is <code>null</code>     * @throws InvalidAlgorithmParameterException if the specified parameters      *   are invalid for this algorithm     */    public abstract void init(XMLStructure parent, XMLCryptoContext context) 	throws InvalidAlgorithmParameterException;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -