本文整理汇总了Java中com.sun.org.apache.xml.internal.security.utils.JavaUtils类的典型用法代码示例。如果您正苦于以下问题:Java JavaUtils类的具体用法?Java JavaUtils怎么用?Java JavaUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaUtils类属于com.sun.org.apache.xml.internal.security.utils包,在下文中一共展示了JavaUtils类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: register
import com.sun.org.apache.xml.internal.security.utils.JavaUtils; //导入依赖的package包/类
/**
* Registers implementing class of the Transform algorithm with algorithmURI
*
* @param algorithmURI algorithmURI URI representation of <code>Transform algorithm</code>
* @param implementingClass <code>implementingClass</code> the implementing
* class of {@link TransformSpi}
* @throws AlgorithmAlreadyRegisteredException if specified algorithmURI
* is already registered
* @throws SecurityException if a security manager is installed and the
* caller does not have permission to register the transform
*/
@SuppressWarnings("unchecked")
public static void register(String algorithmURI, String implementingClass)
throws AlgorithmAlreadyRegisteredException, ClassNotFoundException,
InvalidTransformException {
JavaUtils.checkRegisterPermission();
// are we already registered?
Class<? extends TransformSpi> transformSpi = transformSpiHash.get(algorithmURI);
if (transformSpi != null) {
Object exArgs[] = { algorithmURI, transformSpi };
throw new AlgorithmAlreadyRegisteredException("algorithm.alreadyRegistered", exArgs);
}
Class<? extends TransformSpi> transformSpiClass =
(Class<? extends TransformSpi>)
ClassLoaderUtils.loadClass(implementingClass, Transform.class);
transformSpiHash.put(algorithmURI, transformSpiClass);
}
示例2: register
import com.sun.org.apache.xml.internal.security.utils.JavaUtils; //导入依赖的package包/类
/**
* Registers implementing class of the Transform algorithm with algorithmURI
*
* @param algorithmURI algorithmURI URI representation of <code>SignatureAlgorithm</code>.
* @param implementingClass <code>implementingClass</code> the implementing class of
* {@link SignatureAlgorithmSpi}
* @throws AlgorithmAlreadyRegisteredException if specified algorithmURI is already registered
* @throws XMLSignatureException
* @throws SecurityException if a security manager is installed and the
* caller does not have permission to register the signature algorithm
*/
public static void register(String algorithmURI, Class<? extends SignatureAlgorithmSpi> implementingClass)
throws AlgorithmAlreadyRegisteredException, ClassNotFoundException,
XMLSignatureException {
JavaUtils.checkRegisterPermission();
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "Try to register " + algorithmURI + " " + implementingClass);
}
// are we already registered?
Class<? extends SignatureAlgorithmSpi> registeredClass = algorithmHash.get(algorithmURI);
if (registeredClass != null) {
Object exArgs[] = { algorithmURI, registeredClass };
throw new AlgorithmAlreadyRegisteredException(
"algorithm.alreadyRegistered", exArgs
);
}
algorithmHash.put(algorithmURI, implementingClass);
}
示例3: register
import com.sun.org.apache.xml.internal.security.utils.JavaUtils; //导入依赖的package包/类
/**
* Method register
*
* @param algorithmURI
* @param implementingClass
* @throws AlgorithmAlreadyRegisteredException
* @throws SecurityException if a security manager is installed and the
* caller does not have permission to register the canonicalizer
*/
@SuppressWarnings("unchecked")
public static void register(String algorithmURI, String implementingClass)
throws AlgorithmAlreadyRegisteredException, ClassNotFoundException {
JavaUtils.checkRegisterPermission();
// check whether URI is already registered
Class<? extends CanonicalizerSpi> registeredClass =
canonicalizerHash.get(algorithmURI);
if (registeredClass != null) {
Object exArgs[] = { algorithmURI, registeredClass };
throw new AlgorithmAlreadyRegisteredException("algorithm.alreadyRegistered", exArgs);
}
canonicalizerHash.put(
algorithmURI, (Class<? extends CanonicalizerSpi>)Class.forName(implementingClass)
);
}
示例4: getBytes
import com.sun.org.apache.xml.internal.security.utils.JavaUtils; //导入依赖的package包/类
/**
* Returns the byte array from input which was specified as the parameter of
* {@link XMLSignatureInput} constructor
*
* @return the byte[] from input which was specified as the parameter of
* {@link XMLSignatureInput} constructor
*
* @throws CanonicalizationException
* @throws IOException
*/
public byte[] getBytes() throws IOException, CanonicalizationException {
if (bytes!=null) {
return bytes;
}
InputStream is = getResetableInputStream();
if (is!=null) {
//resetable can read again bytes.
if (bytes==null) {
is.reset();
bytes=JavaUtils.getBytesFromStream(is);
}
return bytes;
}
Canonicalizer20010315OmitComments c14nizer =
new Canonicalizer20010315OmitComments();
bytes=c14nizer.engineCanonicalize(this);
return bytes;
}
示例5: getResetableInputStream
import com.sun.org.apache.xml.internal.security.utils.JavaUtils; //导入依赖的package包/类
protected InputStream getResetableInputStream() throws IOException{
if ((_inputOctetStreamProxy instanceof ByteArrayInputStream) ) {
if (!_inputOctetStreamProxy.markSupported()) {
throw new RuntimeException("Accepted as Markable but not truly been"+_inputOctetStreamProxy);
}
return _inputOctetStreamProxy;
}
if (bytes!=null) {
_inputOctetStreamProxy=new ByteArrayInputStream(bytes);
return _inputOctetStreamProxy;
}
if (_inputOctetStreamProxy ==null)
return null;
if (_inputOctetStreamProxy.markSupported()) {
log.log(java.util.logging.Level.INFO, "Mark Suported but not used as reset");
}
bytes=JavaUtils.getBytesFromStream(_inputOctetStreamProxy);
_inputOctetStreamProxy.close();
_inputOctetStreamProxy=new ByteArrayInputStream(bytes);
return _inputOctetStreamProxy;
}
示例6: register
import com.sun.org.apache.xml.internal.security.utils.JavaUtils; //导入依赖的package包/类
/**
* Registers a ResourceResolverSpi class. This method logs a warning if
* the class cannot be registered.
*
* @param className the name of the ResourceResolverSpi class to be registered
* @throws SecurityException if a security manager is installed and the
* caller does not have permission to register a resource resolver
*/
@SuppressWarnings("unchecked")
public static void register(String className) {
JavaUtils.checkRegisterPermission();
try {
Class<ResourceResolverSpi> resourceResolverClass =
(Class<ResourceResolverSpi>) Class.forName(className);
register(resourceResolverClass, false);
} catch (ClassNotFoundException e) {
log.log(java.util.logging.Level.WARNING, "Error loading resolver " + className + " disabling it");
}
}
示例7: registerAtStart
import com.sun.org.apache.xml.internal.security.utils.JavaUtils; //导入依赖的package包/类
/**
* Registers a ResourceResolverSpi class at the beginning of the provider
* list. This method logs a warning if the class cannot be registered.
*
* @param className the name of the ResourceResolverSpi class to be registered
* @throws SecurityException if a security manager is installed and the
* caller does not have permission to register a resource resolver
*/
@SuppressWarnings("unchecked")
public static void registerAtStart(String className) {
JavaUtils.checkRegisterPermission();
try {
Class<ResourceResolverSpi> resourceResolverClass =
(Class<ResourceResolverSpi>) Class.forName(className);
register(resourceResolverClass, true);
} catch (ClassNotFoundException e) {
log.log(java.util.logging.Level.WARNING, "Error loading resolver " + className + " disabling it");
}
}
示例8: getBytesFromInputStream
import com.sun.org.apache.xml.internal.security.utils.JavaUtils; //导入依赖的package包/类
private byte[] getBytesFromInputStream() throws IOException {
if (bytes != null) {
return bytes;
}
if (inputOctetStreamProxy == null) {
return null;
}
try {
bytes = JavaUtils.getBytesFromStream(inputOctetStreamProxy);
} finally {
inputOctetStreamProxy.close();
}
return bytes;
}