Skip to content

Most visited

Recently visited

navigation
Added in API level 1

SecureClassLoader

public class SecureClassLoader
extends ClassLoader

java.lang.Object
   ↳ java.lang.ClassLoader
     ↳ java.security.SecureClassLoader
Known Direct Subclasses


SecureClassLoader represents a ClassLoader which associates the classes it loads with a code source and provide mechanisms to allow the relevant permissions to be retrieved.

Summary

Protected constructors

SecureClassLoader()

Constructs a new instance of SecureClassLoader.

SecureClassLoader(ClassLoader parent)

Constructs a new instance of SecureClassLoader with the specified parent ClassLoader.

Protected methods

final Class<?> defineClass(String name, byte[] b, int off, int len, CodeSource cs)

Constructs a new class from an array of bytes containing a class definition in class file format with an optional CodeSource.

final Class<?> defineClass(String name, ByteBuffer b, CodeSource cs)

Constructs a new class from an array of bytes containing a class definition in class file format with an optional CodeSource.

PermissionCollection getPermissions(CodeSource codesource)

Returns the PermissionCollection for the specified CodeSource.

Inherited methods

From class java.lang.ClassLoader
From class java.lang.Object

Protected constructors

SecureClassLoader

Added in API level 1
SecureClassLoader ()

Constructs a new instance of SecureClassLoader. The default parent ClassLoader is used.

SecureClassLoader

Added in API level 1
SecureClassLoader (ClassLoader parent)

Constructs a new instance of SecureClassLoader with the specified parent ClassLoader.

Parameters
parent ClassLoader: the parent ClassLoader.

Protected methods

defineClass

Added in API level 1
Class<?> defineClass (String name, 
                byte[] b, 
                int off, 
                int len, 
                CodeSource cs)

Constructs a new class from an array of bytes containing a class definition in class file format with an optional CodeSource.

Parameters
name String: the name of the new class.
b byte: a memory image of a class file.
off int: the start offset in b of the class data.
len int: the length of the class data.
cs CodeSource: the CodeSource, or null.
Returns
Class<?> a new class.
Throws
IndexOutOfBoundsException if off or len are not valid in respect to b.
ClassFormatError if the specified data is not valid class data.
SecurityException if the package to which this class is to be added, already contains classes which were signed by different certificates, or if the class name begins with "java."

defineClass

Added in API level 1
Class<?> defineClass (String name, 
                ByteBuffer b, 
                CodeSource cs)

Constructs a new class from an array of bytes containing a class definition in class file format with an optional CodeSource.

Parameters
name String: the name of the new class.
b ByteBuffer: a memory image of a class file.
cs CodeSource: the CodeSource, or null.
Returns
Class<?> a new class.
Throws
ClassFormatError if the specified data is not valid class data.
SecurityException if the package to which this class is to be added, already contains classes which were signed by different certificates, or if the class name begins with "java."

getPermissions

Added in API level 1
PermissionCollection getPermissions (CodeSource codesource)

Returns the PermissionCollection for the specified CodeSource.

Parameters
codesource CodeSource: the code source.
Returns
PermissionCollection the PermissionCollection for the specified CodeSource.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.