| java.lang.Object com.uwyn.rife.tools.ClassBytesLoader
ClassBytesLoader | public class ClassBytesLoader (Code) | | Utility class to load the bytes of class files.
After instantiating it, the
ClassBytesLoader.setupSunByteLoading method can
optionally be called to let the class detect if it's possible to
interface with a private API that's specific to the Sun JVM. This interface
can improve class byte loading performance by 40%.
author: Geert Bevin (gbevin[remove] at uwyn dot com) version: $Revision: 3811 $ since: 1.6 |
Method Summary | |
public byte[] | getClassBytes(String classFileName) Retrieves a byte array that contains the bytecode for a specific Java
class. | public byte[] | getClassBytes(String classFileName, URL classResource) Retrieves a byte array that contains the bytecode for a specific Java
class. | public boolean | isUsingSunByteLoading() Indicates whether this class is using the private Sun JVM interface to
speed up class bytes loading. | public boolean | setupSunByteLoading() Tries to setup an interaction with a private Sun JVM interface that can
speed up class bytes loading by 40%, when available. |
ClassBytesLoader | public ClassBytesLoader(ClassLoader classLoader)(Code) | | Instantiates a new bytes loader for class files.
Parameters: classLoader - the classloader that should be used to search for theclasses since: 1.6 |
getClassBytes | public byte[] getClassBytes(String classFileName) throws ClassNotFoundException(Code) | | Retrieves a byte array that contains the bytecode for a specific Java
class.
Parameters: classFileName - the file name of the class whose bytes should beloaded, note that this is not the Java FQN ( com.uwyn.rife.Version ),but the real name of the file resource ( com/uwyn/rife/Version.java ) an array with the bytes of the class; or null if no bytes could be loaded throws: FileUtilsErrorException - if an error occurred during the loadingof the class bytes See Also: ClassBytesLoader.getClassBytes(String,URL) since: 1.6 |
getClassBytes | public byte[] getClassBytes(String classFileName, URL classResource) throws ClassNotFoundException(Code) | | Retrieves a byte array that contains the bytecode for a specific Java
class.
Parameters: classFileName - the file name of the class whose bytes should beloaded, note that this is not the Java FQN ( com.uwyn.rife.Version ),but the real name of the file resource ( com/uwyn/rife/Version.java ) Parameters: classResource - the resource that can be used to load the classbytes from if it couldn't be obtained by using the file name, if noresource is provided and the bytes couldn't be loaded by simply usingthe class' file name, a resource will be looked up for the file namethrough the class loader that was provided to the constructor an array with the bytes of the class; or null if no bytes could be loaded throws: FileUtilsErrorException - if an error occurred during the loadingof the class bytes See Also: ClassBytesLoader.getClassBytes(String) since: 1.6 |
isUsingSunByteLoading | public boolean isUsingSunByteLoading()(Code) | | Indicates whether this class is using the private Sun JVM interface to
speed up class bytes loading.
true when this class is using the private Sun JVMinterface; or false if this is not the case since: 1.6 |
setupSunByteLoading | public boolean setupSunByteLoading()(Code) | | Tries to setup an interaction with a private Sun JVM interface that can
speed up class bytes loading by 40%, when available.
true when the interaction with the private Sun JVMinterface could be setup; or false otherwise |
|
|