com.croftsoft.core.lang.classloader
Class NetClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by com.croftsoft.core.lang.classloader.CustomClassLoader
          extended by com.croftsoft.core.lang.classloader.NetClassLoader
Direct Known Subclasses:
CacheClassLoader

public class NetClassLoader
extends CustomClassLoader

Upgrade this source code when the switch is made from Java 1.1 to Java 1.2.

References Scott Oaks, Java Security, O'Reilly, 1998.

Version:
1998-09-06
Author:
David Wallace Croft

Field Summary
protected  URL codebaseURL
           
 
Constructor Summary
NetClassLoader(URL codebaseURL)
          Ex: "http://www.mysticmayhem.com/lib/"
 
Method Summary
 Image createImage(String imageName)
          Creates the image by calling getResourceAsStream(imageName).
 URL getResource(String name)
           
 InputStream getResourceAsStream(String name)
          Loads a stream from the URL given by getResource(name).
static void invokeMain(Class c, String[] args)
           
static void launchMain(String codebaseURLName, String mainClassName, String[] args)
          Loads a remote class and launches its main() method.
protected  byte[] loadClassData(String name)
          Implement to load the raw bytecode from an external source.
static void main(String[] args)
          Loads a remote class and launches its main() method.
 
Methods inherited from class com.croftsoft.core.lang.classloader.CustomClassLoader
loadClass, parsePackageName
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, 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
 

Field Detail

codebaseURL

protected URL codebaseURL
Constructor Detail

NetClassLoader

public NetClassLoader(URL codebaseURL)
Ex: "http://www.mysticmayhem.com/lib/"

Method Detail

main

public static void main(String[] args)
                 throws Exception
Loads a remote class and launches its main() method.

Parameters:
Command-line - arguments:
  1. The URL for the codebase.
  2. The name of the class with the "main(args)" method.
  3. Subsequent arguments to be passed to the invoked main method.
Example
Throws:
Exception

launchMain

public static void launchMain(String codebaseURLName,
                              String mainClassName,
                              String[] args)
                       throws ClassNotFoundException,
                              IllegalAccessException,
                              MalformedURLException
Loads a remote class and launches its main() method.

Throws:
ClassNotFoundException
IllegalAccessException
MalformedURLException

invokeMain

public static void invokeMain(Class c,
                              String[] args)
                       throws IllegalAccessException
Throws:
IllegalAccessException

loadClassData

protected byte[] loadClassData(String name)
Description copied from class: CustomClassLoader
Implement to load the raw bytecode from an external source.

Specified by:
loadClassData in class CustomClassLoader
Returns:
May return null on failure.

getResource

public URL getResource(String name)
Overrides:
getResource in class ClassLoader

getResourceAsStream

public InputStream getResourceAsStream(String name)
Loads a stream from the URL given by getResource(name). Does not use a cache.

Overrides:
getResourceAsStream in class ClassLoader

createImage

public Image createImage(String imageName)
                  throws IOException
Creates the image by calling getResourceAsStream(imageName).

Throws:
IOException

CroftSoft Javadoc

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