ClassLoader.defineClass

ClassLoader.defineClass

Class Overview | Class Members | This Package | All Packages

Syntax 1
protected final Class defineClass( byte data[], int offset, int length )
Parameters
data
the bytes that make up the Class.
offset
the start offset of the Class data.
length
the length of the Class data.
Returns
the Class object that was created from the data.
Description
Note: defineClass() is deprecated. Replaced by defineClass(java.lang.String, byte[], int, int).

Converts an array of bytes into an instance of class Class. Before the Class can be used it must be resolved. This method is deprecated in favor of the version that takes a "name" as a first argument, and is more secure.

Exceptions
ClassFormatError if the data does not contain a valid Class.
See Also
loadClass, resolveClass



Syntax 2
protected final Class defineClass( String name, byte data[], int offset, int length )
Parameters
name
the expected name of the class; null if unknown; using '.' and not '/' as separator, and without a trailing ".class" suffix.
data
the bytes that make up the Class.
offset
the start offset of the Class data.
length
the length of the Class data.
Returns
the Class object that was created from the data.
Description
Converts an array of bytes to an instance of class Class. Before the Class can be used it must be resolved.

Exceptions
ClassFormatError if the data does not contain a valid Class.
See Also
loadClass, resolveClass