Class ByteClassLoader


  • public class ByteClassLoader
    extends java.lang.ClassLoader
    A subclass of ClassLoader that can take a byte[] containing a class file.
    • Constructor Summary

      Constructors 
      Constructor Description
      ByteClassLoader​(byte[] bytes)
      Constructor taking a class as an array of bytes.
      ByteClassLoader​(java.io.File binaryFile)
      Constructor that reads data from a file.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Class defineClass()
      Define the class that this class loader knows about.
      • Methods inherited from class java.lang.ClassLoader

        clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ByteClassLoader

        public ByteClassLoader​(java.io.File binaryFile)
        Constructor that reads data from a file.
        Parameters:
        binaryFile - A file containing a Java class.
      • ByteClassLoader

        public ByteClassLoader​(byte[] bytes)
        Constructor taking a class as an array of bytes.
        Parameters:
        bytes - Array of bytes containing a class definition.
    • Method Detail

      • defineClass

        public java.lang.Class defineClass()
        Define the class that this class loader knows about. The name of the class is taken from the data given in the constructor.

        Note that this does *not* override any of the java.lang.ClassLoader#defineClass methods. Calling this method directly is the only way to get the class defined by this classloader.

        Returns:
        A new Class object for this class.