Represents the running virtual machine. All VM specific API are implemented on this class.
Note that all methods in VM are static. There is no singleton instance which represents the actively running VM.
Static Public Member Functions | |
static final ClassLoader | getNonBootstrapClassLoader () |
This method must be provided by the vm vendor, as it is used by other provided class implementations. | |
static final void | initializeClassLoader (ClassLoader loader, boolean bootLoader) |
Initialize the classloader. | |
static final String | intern (String string) |
This method must be provided by the vm vendor. | |
static ClassLoader | callerClassLoader () |
This method must be included, as it is used by ResourceBundle.getBundle(), and other places as well. | |
static ClassLoader | bootCallerClassLoader () |
This method must be provided by the vm vendor, as it is used by org.apache.harmony.luni.util.MsgHelp.setLocale() to get the bootstrap ClassLoader. | |
static void | dumpString (String str) |
Native used to dump a string to the system console for debugging. | |
static void | addShutdownHook (Thread hook) |
Registers a new virtual-machine shutdown hook. | |
static boolean | removeShutdownHook (Thread hook) |
De-registers a previously-registered virtual-machine shutdown hook. | |
static void | closeJars () |
This method must be provided by the vm vendor. | |
static void | deleteOnExit () |
This method must be provided by the vm vendor. | |
static String[] | getVMArgs () |
Returns command line arguments passed to the VM. | |
static int | getKernelVersion () |
This method must be provided by the vm vendor. | |
Static Package Functions | |
static final ClassLoader | getStackClassLoader (int depth) |
This method must be provided by the vm vendor, as it is used by org.apache.harmony.kernel.vm.MsgHelp.setLocale() to get the bootstrap ClassLoader. | |
static Class<?> | findClassOrNull (String className, ClassLoader classLoader) |
Native used to find and load a class using the VM. | |
static int | getCPIndexImpl (Class<?> targetClass) |
Get the classpath entry that was used to load the class that is the arg. | |
static void | initializeVM () |
Does internal initialization required by VM. | |
static final int | getClassPathEntryType (Object classLoader, int cpIndex) |
Return the type of the specified entry on the class path for a ClassLoader. | |
static int | getClassPathCount () |
Return the number of entries on the bootclasspath. | |
static byte[] | getPathFromClassPath (int index) |
Return the specified bootclasspath entry. | |
Static Package Attributes | |
static final int | CPE_TYPE_UNKNOWN = 0 |
static final int | CPE_TYPE_DIRECTORY = 1 |
static final int | CPE_TYPE_JAR = 2 |
static final int | CPE_TYPE_TCP = 3 |
static final int | CPE_TYPE_UNUSABLE = 5 |
Static Private Attributes | |
static final int | kernelVersion = 0x01000100 |
static final ClassLoader org.apache.harmony.kernel.vm.VM.getStackClassLoader | ( | int | depth | ) | [static, package] |
This method must be provided by the vm vendor, as it is used by org.apache.harmony.kernel.vm.MsgHelp.setLocale() to get the bootstrap ClassLoader.
MsgHelp uses the bootstrap ClassLoader to find the resource bundle of messages packaged with the bootstrap classes. Returns the ClassLoader of the method (including natives) at the specified depth on the stack of the calling thread. Frames representing the VM implementation of java.lang.reflect are not included in the list. This is not a public method as it can return the bootstrap class loader, which should not be accessed by non-bootstrap classes. Notes:
depth | the stack depth of the requested ClassLoader |
static final ClassLoader org.apache.harmony.kernel.vm.VM.getNonBootstrapClassLoader | ( | ) | [static] |
This method must be provided by the vm vendor, as it is used by other provided class implementations.
For example, java.io.ObjectInputStream.readObject() and java.io.ObjectInputStream.resolveProxyClass(). It is also useful for other classes, such as java.rmi.server.RMIClassLoader. Walk the stack and answer the most recent non-null and non-bootstrap ClassLoader on the stack of the calling thread. If no such ClassLoader is found, null is returned. Notes: 1) This method operates on the defining classes of methods on stack. NOT the classes of receivers.
static final void org.apache.harmony.kernel.vm.VM.initializeClassLoader | ( | ClassLoader | loader, | |
boolean | bootLoader | |||
) | [static] |
Initialize the classloader.
loader | ClassLoader the ClassLoader instance | |
bootLoader | boolean true for the bootstrap class loader |
static final String org.apache.harmony.kernel.vm.VM.intern | ( | String | string | ) | [static] |
This method must be provided by the vm vendor.
Searches an internal table of strings for a string equal to the specified String. If the string is not in the table, it is added. Answers the string contained in the table which is equal to the specified String. The same string object is always answered for strings which are equal.
string | the String to intern |
static Class<?> org.apache.harmony.kernel.vm.VM.findClassOrNull | ( | String | className, | |
ClassLoader | classLoader | |||
) | [static, package] |
Native used to find and load a class using the VM.
className | String the name of the class to search for. | |
classLoader | the classloader to do the work |
static ClassLoader org.apache.harmony.kernel.vm.VM.callerClassLoader | ( | ) | [static] |
This method must be included, as it is used by ResourceBundle.getBundle(), and other places as well.
The reference implementation of this method uses the getStackClassLoader() method. Returns the ClassLoader of the method that called the caller. i.e. A.x() calls B.y() calls callerClassLoader(), A's ClassLoader will be returned. Returns null for the bootstrap ClassLoader.
SecurityException | when called from a non-bootstrap Class |
static ClassLoader org.apache.harmony.kernel.vm.VM.bootCallerClassLoader | ( | ) | [static] |
This method must be provided by the vm vendor, as it is used by org.apache.harmony.luni.util.MsgHelp.setLocale() to get the bootstrap ClassLoader.
MsgHelp uses the bootstrap ClassLoader to find the resource bundle of messages packaged with the bootstrap classes. The reference implementation of this method uses the getStackClassLoader() method.
Returns the ClassLoader of the method that called the caller. i.e. A.x() calls B.y() calls callerClassLoader(), A's ClassLoader will be returned. Returns null for the bootstrap ClassLoader.
SecurityException | when called from a non-bootstrap Class |
static void org.apache.harmony.kernel.vm.VM.dumpString | ( | String | str | ) | [static] |
Native used to dump a string to the system console for debugging.
str | String the String to display |
static int org.apache.harmony.kernel.vm.VM.getCPIndexImpl | ( | Class<?> | targetClass | ) | [static, package] |
Get the classpath entry that was used to load the class that is the arg.
This method is for internal use only.
targetClass | Class the class to set the classpath of. |
static void org.apache.harmony.kernel.vm.VM.initializeVM | ( | ) | [static, package] |
Does internal initialization required by VM.
static void org.apache.harmony.kernel.vm.VM.addShutdownHook | ( | Thread | hook | ) | [static] |
Registers a new virtual-machine shutdown hook.
This is equivalent to the 1.3 API of the same name.
hook | the hook (a Thread) to register |
static boolean org.apache.harmony.kernel.vm.VM.removeShutdownHook | ( | Thread | hook | ) | [static] |
De-registers a previously-registered virtual-machine shutdown hook.
This is equivalent to the 1.3 API of the same name.
hook | the hook (a Thread) to de-register |
static void org.apache.harmony.kernel.vm.VM.closeJars | ( | ) | [static] |
This method must be provided by the vm vendor.
Called to signal that the org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection class has been loaded and JarURLConnection.closeCachedFiles() should be called on VM shutdown.
static void org.apache.harmony.kernel.vm.VM.deleteOnExit | ( | ) | [static] |
This method must be provided by the vm vendor.
Called to signal that the org.apache.harmony.luni.util.DeleteOnExit class has been loaded and DeleteOnExit.deleteOnExit() should be called on VM shutdown.
static final int org.apache.harmony.kernel.vm.VM.getClassPathEntryType | ( | Object | classLoader, | |
int | cpIndex | |||
) | [static, package] |
Return the type of the specified entry on the class path for a ClassLoader.
Valid types are: CPE_TYPE_UNKNOWN CPE_TYPE_DIRECTORY CPE_TYPE_JAR CPE_TYPE_TCP - this is obsolete CPE_TYPE_UNUSABLE
classLoader | the ClassLoader | |
cpIndex | the index on the class path |
static String [] org.apache.harmony.kernel.vm.VM.getVMArgs | ( | ) | [static] |
Returns command line arguments passed to the VM.
Internally these are broken into optionString and extraInfo. This only returns the optionString part.
static int org.apache.harmony.kernel.vm.VM.getClassPathCount | ( | ) | [static, package] |
Return the number of entries on the bootclasspath.
static byte [] org.apache.harmony.kernel.vm.VM.getPathFromClassPath | ( | int | index | ) | [static, package] |
Return the specified bootclasspath entry.
index | the index of the bootclasspath entry |
static int org.apache.harmony.kernel.vm.VM.getKernelVersion | ( | ) | [static] |
This method must be provided by the vm vendor.
Returns an int containing the version number of the kernel. Used to check for kernel compatibility.
Genereated on Tue Dec 9 14:09:48 2008 by Doxygen.
(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.