com.croftsoft.core.lang.classloader
Class Boot

java.lang.Object
  extended by java.lang.ClassLoader
      extended by com.croftsoft.core.lang.classloader.Boot

public class Boot
extends ClassLoader

The Boot ClassLoader bootstraps a main class downloaded directly off of a web site. The argument to this program is the URL of the main class bytecode file. Any additional arguments are passed to the downloaded class.

The Boot class can be readily distributed to a wide audience since it is small and simple. With a little customization, it can be hard-coded to download from a particular URL. It can also be used as a "seed" class by having it invoke a persistent resource loader.

Version:
1999-11-27
Author:
David Wallace Croft

Constructor Summary
Boot()
           
 
Method Summary
 void bootstrap(byte[] data, String[] args)
          Converts the data to a Class and then invokes its main(args) method.
static byte[] downloadBytes(URL url)
          Returns null upon failure.
static InputStream downloadStream(URL url)
          Returns null upon failure.
static void invokeMain(Class c, String[] args)
          Uses reflection to invoke the main(args) method of a class.
 Class loadClass(String name, boolean resolve)
          Returns the Class of the given name.
static void main(String[] args)
           
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, 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

Boot

public Boot()
Method Detail

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

downloadBytes

public static byte[] downloadBytes(URL url)
Returns null upon failure.


downloadStream

public static InputStream downloadStream(URL url)
Returns null upon failure.


invokeMain

public static void invokeMain(Class c,
                              String[] args)
                       throws IllegalAccessException
Uses reflection to invoke the main(args) method of a class.

Throws:
IllegalAccessException

bootstrap

public void bootstrap(byte[] data,
                      String[] args)
               throws IllegalAccessException
Converts the data to a Class and then invokes its main(args) method.

Throws:
IllegalAccessException

loadClass

public Class loadClass(String name,
                       boolean resolve)
Returns the Class of the given name.

Overrides:
loadClass in class ClassLoader

CroftSoft Javadoc

CroftSoft Core Javadoc (2008-09-28 20:58:02)