Top Description Fields Constructors Methods
org.lwjgl.util.mapped

public Class MappedObjectClassLoader

extends URLClassLoader
Class Inheritance
Imports
org.lwjgl.LWJGLUtil, java.io.IOException, .InputStream, java.lang.reflect.InvocationTargetException, .Method, java.net.URLClassLoader

This classloader is responsible for applying the bytecode transformation to mapped objects. The transformation can either be applied using a Java agent, or with the convenient fork method.
Author
Riven

Field Summary

Modifier and TypeField and Description
pack-priv static boolean
pack-priv static final String
private static long

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static byte[]
copyOf(byte[] original, int newLength)

public static boolean

Returns:

true if the fork was successful.
fork
(Class<?>
the class containing the main method
mainClass
,
String[]
the arguments to pass
args
)

Forks the specified class containing a main method, passing the specified arguments.

protected synchronized Class<?>
loadClass(String
The binary name of the class
name
,
boolean
If true then resolve the class
resolve
)

Overrides java.lang.ClassLoader.loadClass.

Loads the class with the specified binary name.
protected synchronized Class<?>
private static void
printActivity(final String className, final long t0, final long t1)

private static byte[]
Inherited from java.net.URLClassLoader:
addURLclosedefinePackagefindClassfindResourcefindResourcesgetPermissionsgetResourceAsStreamgetURLsnewInstancenewInstance

Field Detail

FORKEDback to summary
pack-priv static boolean FORKED
MAPPEDOBJECT_PACKAGE_PREFIXback to summary
pack-priv static final String MAPPEDOBJECT_PACKAGE_PREFIX
total_time_transformingback to summary
private static long total_time_transforming

Constructor Detail

MappedObjectClassLoaderback to summary
private MappedObjectClassLoader(Class<?> mainClass)

Method Detail

copyOfback to summary
private static byte[] copyOf(byte[] original, int newLength)
forkback to summary
public static boolean fork(Class<?> mainClass, String[] args)

Forks the specified class containing a main method, passing the specified arguments. See org.lwjgl.test.mapped.TestMappedObject for example usage.

Parameters
mainClass:Class<?>

the class containing the main method

args:String[]

the arguments to pass

Returns:boolean

true if the fork was successful.

loadClassback to summary
protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException

Overrides java.lang.ClassLoader.loadClass.

Doc from java.lang.ClassLoader.loadClass.

Loads the class with the specified binary name. The default implementation of this method searches for classes in the following order:

  1. Invoke findLoadedClass(String) to check if the class has already been loaded.

  2. Invoke the loadClass method on the parent class loader. If the parent is null the class loader built into the virtual machine is used, instead.

  3. Invoke the findClass(String) method to find the class.

If the class was found using the above steps, and the resolve flag is true, this method will then invoke the resolveClass(Class) method on the resulting Class object.

Subclasses of ClassLoader are encouraged to override findClass(String), rather than this method.

Unless overridden, this method synchronizes on the result of getClassLoadingLock method during the entire class loading process.

Parameters
name:String

The binary name of the class

resolve:boolean

If true then resolve the class

Returns:Class<?>

The resulting Class object

Annotations
@Override
Exceptions
ClassNotFoundException:
If the class could not be found
loadMappedObjectback to summary
protected synchronized Class<?> loadMappedObject() throws ClassNotFoundException
printActivityback to summary
private static void printActivity(final String className, final long t0, final long t1)
readStreamback to summary
private static byte[] readStream(InputStream in)