Class SquidClassLoader

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class SquidClassLoader
    extends ClassLoader
    implements Closeable
    Class loader, which is able to load classes from a list of JAR files and directories.
    • Constructor Detail

      • SquidClassLoader

        public SquidClassLoader​(List<File> files)
        Parameters:
        files - ordered list of files and directories from which to load classes and resources
    • Method Detail

      • getBytesForClass

        @CheckForNull
        public byte[] getBytesForClass​(String className)
        Read bytes representing class with name passed as an argument. Modify the class version in bytecode so ASM can read returned array without issues.
        Parameters:
        className - canonical name of the class (e.g. org.acme.Foo )
        Returns:
        bytes or null if class is not found
      • close

        public void close()
        Closes this class loader, so that it can no longer be used to load new classes or resources. Any classes or resources that are already loaded, are still accessible. If class loader is already closed, then invoking this method has no effect.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable