Microsoft SDK for Java

defineClass

This method of the SecurityClassLoader Class converts an array of bytes into an instance of Class and associates the new class with a set of permissions and a principal.

Syntax

protected final synchronized Class defineClass(String name,byte data[],int offset,int length, PermissionSet permissions,Principal principal);

Return Value

Returns the Class object that was created from the data.

Parameters

name The expected name of the class, using "." (not "/") as a separator, and without a trailing .class suffix. This value will be null if the name is unknown.
data The bytes that make up the class.
offset The start offset of the class data.
length The length of the class data.
permissions The permissions to associate with the new class. The value can be null, in which case the new class will have no associated permissions.
principal The principal to associate with the new class. The value can be null, in which case the new class will have no associated principal.

Remarks

This method is similar to the java.lang.Class.defineClass method with the added ability to associate a set of permissions with a class. As with the java.lang.Class.defineClass method, the class must be resolved before it can be used.

Exceptions

ClassFormatError if the data does not contain a valid Class.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.