freaklamarsch.lang
Class FLMClassLoader

java.lang.Object
  |
  +--java.lang.ClassLoader
        |
        +--freaklamarsch.lang.FLMClassLoader

public class FLMClassLoader
extends java.lang.ClassLoader

This implementation extends the ClassLoader so that given a path to a classfile it tries to load this class into the VM. It also has methods to ask the user for a File if it can't be found. It's a work in progress.

Author:
FReAK La Marsch

Nested Class Summary
 
Nested classes inherited from class java.lang.ClassLoader
 
Field Summary
(package private)  java.awt.Frame parent
           
 
Fields inherited from class java.lang.ClassLoader
 
Constructor Summary
FLMClassLoader()
          The constructor
FLMClassLoader(java.awt.Frame parent)
          Another constructor
FLMClassLoader(java.awt.Frame parent, java.lang.String classpath)
          Another constructor
FLMClassLoader(java.lang.String classpath)
          Another constructor
 
Method Summary
static java.lang.String calculateClassName(java.lang.String classLocation, java.lang.String cp)
          calculates the name of a given class file
 java.lang.Class loadClass(java.lang.String file)
          Calls loadClass(className, true)
protected  java.lang.Class loadClass(java.lang.String file, boolean resolve)
          This version of loadClass method is called both from loadClass above and from the internal function FindClassFromClass.
 java.lang.Class loadCompiledClass(java.lang.String file)
          loadCompiledClass will load classes into the VM from a known location it reads the given file and converts it to a class
 java.lang.Class loadCompiledClass(java.lang.String file, java.lang.String className)
           
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, 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

parent

java.awt.Frame parent
Constructor Detail

FLMClassLoader

public FLMClassLoader()
The constructor


FLMClassLoader

public FLMClassLoader(java.lang.String classpath)
Another constructor


FLMClassLoader

public FLMClassLoader(java.awt.Frame parent)
Another constructor


FLMClassLoader

public FLMClassLoader(java.awt.Frame parent,
                      java.lang.String classpath)
Another constructor

Method Detail

loadClass

public java.lang.Class loadClass(java.lang.String file)
                          throws java.lang.ClassNotFoundException
Calls loadClass(className, true)

Overrides:
loadClass in class java.lang.ClassLoader
Returns:
the resulting Class object
Throws:
java.lang.ClassNotFoundException - if the class could not be found

loadClass

protected java.lang.Class loadClass(java.lang.String file,
                                    boolean resolve)
                             throws java.lang.ClassNotFoundException,
                                    java.lang.NoClassDefFoundError
This version of loadClass method is called both from loadClass above and from the internal function FindClassFromClass. It checks, if the class is already loaded and if not it will load the class

Overrides:
loadClass in class java.lang.ClassLoader
Parameters:
resolve - if true then resolve the class
Returns:
the resulting Class object
Throws:
java.lang.ClassNotFoundException - if the class could not be found
java.lang.NoClassDefFoundError

loadCompiledClass

public java.lang.Class loadCompiledClass(java.lang.String file)
loadCompiledClass will load classes into the VM from a known location it reads the given file and converts it to a class

Returns:
the resulting Class object

loadCompiledClass

public java.lang.Class loadCompiledClass(java.lang.String file,
                                         java.lang.String className)
                                  throws java.lang.ClassFormatError,
                                         java.lang.NoClassDefFoundError
java.lang.ClassFormatError
java.lang.NoClassDefFoundError

calculateClassName

public static java.lang.String calculateClassName(java.lang.String classLocation,
                                                  java.lang.String cp)
calculates the name of a given class file

Parameters:
classLocation - complete path to the .class-File (like c:\mydir\myclass.class)
cp - classpath ehich is used to load this class