org.objectweb.fractal.aokell.lib.util
Class PlatformHelper

java.lang.Object
  extended by org.objectweb.fractal.aokell.lib.util.PlatformHelper

public class PlatformHelper
extends Object

This class contains helper methods with an implementation which differs depending on the choosen version of the platform feature.

Author:
Lionel Seinturier

Constructor Summary
PlatformHelper()
           
 
Method Summary
static Class defineClass(String name, byte[] b)
          Define a new class.
static void dumpClassToFile(String dirname, String classname, byte[] b)
          Utility method to write the bytecode from a class to a file.
static InputStream getResourceAsStream(String name)
          Load a ressource.
static Class loadClass(String name)
          Load a class.
static void setLoader(Object cl)
          Set the loader to be used by AOKell for loading classes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlatformHelper

public PlatformHelper()
Method Detail

setLoader

public static void setLoader(Object cl)
Set the loader to be used by AOKell for loading classes.

Parameters:
cl - the loader. This parameter must implement ClassLoader. It is declared as an Object in order to be compliant with the J2ME version of AOKell.

loadClass

public static Class loadClass(String name)
                       throws ClassNotFoundException
Load a class.

Throws:
ClassNotFoundException

getResourceAsStream

public static InputStream getResourceAsStream(String name)
Load a ressource.


defineClass

public static Class defineClass(String name,
                                byte[] b)
Define a new class.


dumpClassToFile

public static void dumpClassToFile(String dirname,
                                   String classname,
                                   byte[] b)
                            throws IOException
Utility method to write the bytecode from a class to a file. This method creates the directory structure corresponding to package names.

Parameters:
dirname - the root directory name
classname - the name of the class
b - the bytecode
Throws:
IOException