public class SecureClassLoader extends ClassLoader
| Modifier | Constructor and Description |
|---|---|
protected |
SecureClassLoader()
创建一个使用默认的父类装载器为代表的新secureclassloader。
|
protected |
SecureClassLoader(ClassLoader parent)
创建一个使用指定的父类装载器为代表的新secureclassloader。
|
| Modifier and Type | Method and Description |
|---|---|
protected 类<?> |
defineClass(String name, byte[] b, int off, int len, CodeSource cs)
将字节数组转换为类的类的一个实例,一个可选的CodeSource。
|
protected 类<?> |
defineClass(String name, ByteBuffer b, CodeSource cs)
将
ByteBuffer到
类类实例,一个可选的CodeSource。
|
protected PermissionCollection |
getPermissions(CodeSource codesource)
返回给定代码资源对象的权限。
|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSignersprotected SecureClassLoader(ClassLoader parent)
如果存在安全管理器,该方法首先调用安全管理器的checkCreateClassLoader方法保证一个类加载器的创作是允许的。
parent -父类加载器
SecurityException -如果存在一个安全管理及其
checkCreateClassLoader方法不允许一个类装载器创建。
SecurityManager.checkCreateClassLoader()
protected SecureClassLoader()
如果存在安全管理器,该方法首先调用安全管理器的checkCreateClassLoader方法保证一个类加载器的创作是允许的。
SecurityException -如果存在一个安全管理及其
checkCreateClassLoader方法不允许一个类装载器创建。
SecurityManager.checkCreateClassLoader()
protected final 类<?> defineClass(String name, byte[] b, int off, int len, CodeSource cs)
如果一个非空的CodeSource提供ProtectionDomain的建造和被定义的类关联。
name -类要求的名称,或
null如果不知道,用“。”而不是“/”作为分隔符和无尾”。班”后缀。
b,弥补该类数据的字节。通过
off+len-1位置
off字节应该有有效的类文件格式的定义由
The Java™ Virtual Machine Specification。
off在类的数据
b的起始偏移量
len -该类数据的长度
cs -相关
null CodeSource,或者如果没有
类对象,和可选的CodeSource。
ClassFormatError -如果数据不包含一个有效的课堂
IndexOutOfBoundsException -如果
off或
len是负的,或如果
off+len大于
b.length。
SecurityException -如果尝试添加这类包,包含的类是由一组不同的证书比这类签名,或者类的名字开始与“java”。
protected final 类<?> defineClass(String name, ByteBuffer b, CodeSource cs)
ByteBuffer到
类类实例,一个可选的CodeSource。方法重写,继承类前可以用它必须解决。
如果一个非空的CodeSource提供ProtectionDomain的建造和被定义的类关联。
name -类要求的名称,或
null如果不知道,用“。”而不是“/”作为分隔符和无尾”。班”后缀。
b,弥补该类数据的字节。从
b.position()字节位置通过
b.position() + b.limit() -1应该有有效的类文件格式的定义由
The Java™ Virtual Machine Specification。
cs -相关
null CodeSource,或者如果没有
类对象,和可选的CodeSource。
ClassFormatError -如果数据不包含一个有效的课堂
SecurityException -如果尝试添加这类包,包含的类是由一组不同的证书比这类签名,或者类的名字开始与“java”。
protected PermissionCollection getPermissions(CodeSource codesource)
这个方法被调用的方法,以defineclass CodeSource作为参数时,它是构建所定义的类的保护范围。
codesource - CodeSource。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.