FileDocCategorySizeDatePackage
VMClassLoader.javaAPI DocAndroid 1.5 API4276Wed May 06 22:41:04 BST 2009java.lang

VMClassLoader

public class VMClassLoader extends Object

Fields Summary
Constructors Summary
Methods Summary
static native java.lang.ClassdefineClass(java.lang.ClassLoader cl, java.lang.String name, byte[] data, int offset, int len, java.security.ProtectionDomain pd)

static native java.lang.ClassdefineClass(java.lang.ClassLoader cl, byte[] data, int offset, int len, java.security.ProtectionDomain pd)

static native java.lang.ClassfindLoadedClass(java.lang.ClassLoader cl, java.lang.String name)

private static native java.lang.StringgetBootClassPathResource(java.lang.String name, int index)

private static native intgetBootClassPathSize()
Boot class path manipulation, for getResources().

static native java.lang.ClassgetPrimitiveClass(char type)

static java.net.URLgetResource(java.lang.String name)
Get a resource from a file in the bootstrap class path. It would be simpler to just walk through the class path elements ourselves, but that would require reopening Jar files. We assume that the bootclasspath can't change once the VM has started. This assumption seems to be supported by the spec.

        int numEntries = getBootClassPathSize();
        int i;

        for (i = 0; i < numEntries; i++) {
            String urlStr = getBootClassPathResource(name, i);
            if (urlStr != null) {
                try {
                    return new URL(urlStr);
                }
                catch (MalformedURLException mue) {
                    mue.printStackTrace();
                    // unexpected; keep going
                }
            }
        }

        return null;
    
static java.util.EnumerationgetResources(java.lang.String name)

        ArrayList<URL> list = null;
        int numEntries = getBootClassPathSize();
        int i;

        for (i = 0; i < numEntries; i++) {
            String urlStr = getBootClassPathResource(name, i);
            if (urlStr != null) {
                if (list == null)
                    list = new ArrayList<URL>();

                try {
                    list.add(new URL(urlStr));
                }
                catch (MalformedURLException mue) {
                    mue.printStackTrace();
                    // unexpected; keep going
                }
            }
        }

        if (list == null)
            return null;
        else
            return new EnumerateListArray<URL>(list);
    
static native java.lang.ClassloadClass(java.lang.String name, boolean resolve)
Load class with bootstrap class loader.