com.github.libxjava.lang
Class SimpleClassLoader

java.lang.Object
  extended by com.github.libxjava.lang.SimpleClassLoader
All Implemented Interfaces:
IClassLoader

public class SimpleClassLoader
extends Object
implements IClassLoader

Version:
libxjava-cldc - 0.3
Author:
Marcel Patzlaff

Constructor Summary
SimpleClassLoader()
           
 
Method Summary
 InputStream getResourceAsStream(String name)
          Finds a resource with the given name in the classpath of this classloader.
 Class loadClass(String name)
          Returns the Class object associated with the class with the given name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleClassLoader

public SimpleClassLoader()
Method Detail

getResourceAsStream

public InputStream getResourceAsStream(String name)
Description copied from interface: IClassLoader
Finds a resource with the given name in the classpath of this classloader. This method returns null if no resource with this name is found.

The resource names can be represented in two different formats: absolute or relative.

Absolute format:

Relative format:

In the absolute format, the programmer provides a fully qualified name that includes both the full path and the name of the resource inside the classpath. In the path names, the character "/" is used as the separator.

In the relative format, the programmer provides only the name of the actual resource. Relative names are converted to absolute names by the system by prefixing the resource name with the fully qualified package name of class upon which the getResourceAsStream method was called.

Specified by:
getResourceAsStream in interface IClassLoader
Parameters:
name - name of the desired resource
Returns:
a java.io.InputStream object

loadClass

public Class loadClass(String name)
                throws ClassNotFoundException
Description copied from interface: IClassLoader
Returns the Class object associated with the class with the given name. The classpath currently associated with this classloader will be searched.

Specified by:
loadClass in interface IClassLoader
Parameters:
name - the fully qualified name of the desired class
Returns:
the Class object for the class with the specified name
Throws:
ClassNotFoundException - if the class could not be found


Copyright © 2011 Marcel Patzlaff. All Rights Reserved.