Return to www.inductionframework.org

com.acciente.commons.loader
Class ByteCodeClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by com.acciente.commons.loader.ByteCodeClassLoader

public class ByteCodeClassLoader
extends java.security.SecureClassLoader

A classloader to load a class using the byte code data

Author:
Adinath Raveendra Raj

Constructor Summary
ByteCodeClassLoader()
          Creates a class loader with no parent class loader, this is expected to cause the system class loader to be used as the parent class loader
ByteCodeClassLoader(java.lang.ClassLoader oParentClassLoader)
          Creates a class loader that delegates to the specified parent class loader
 
Method Summary
 void addClassDef(java.lang.String sClassName, byte[] ayClassByteCode)
          Add a class defined by its byte code to this loader.
protected  java.lang.Class findClass(java.lang.String sClassName)
          Override the default implementation of the standard findClass() method to load in our classes defined via addClassDef()
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass, getPermissions
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteCodeClassLoader

public ByteCodeClassLoader()
Creates a class loader with no parent class loader, this is expected to cause the system class loader to be used as the parent class loader


ByteCodeClassLoader

public ByteCodeClassLoader(java.lang.ClassLoader oParentClassLoader)
Creates a class loader that delegates to the specified parent class loader

Parameters:
oParentClassLoader - the parent class loader
Method Detail

addClassDef

public void addClassDef(java.lang.String sClassName,
                        byte[] ayClassByteCode)
Add a class defined by its byte code to this loader.

Parameters:
sClassName - the class name
ayClassByteCode - the byte code buffer

findClass

protected java.lang.Class findClass(java.lang.String sClassName)
                             throws java.lang.ClassNotFoundException
Override the default implementation of the standard findClass() method to load in our classes defined via addClassDef()

Overrides:
findClass in class java.lang.ClassLoader
Parameters:
sClassName - the name of the class to load
Returns:
a newly loaded Class object representing sClassName
Throws:
java.lang.ClassNotFoundException - thrown if this method was unable to load a clas corresponding to sClassName

Return to www.inductionframework.org

Copyright © 2008-2011 Acciente, LLC. All Rights Reserved.