FileDocCategorySizeDatePackage
ResourceLoader.javaAPI DocAndroid 1.5 API4265Wed May 06 22:41:16 BST 2009com.vladium.util

ResourceLoader

public abstract class ResourceLoader extends Object
A static API that can be used as a drop-in replacement for java.lang.ClassLoader API (the class/resource loading part). This implementation is merely a wrapper around ClassLoaderResolverget.ClassLoader() method.
author
Vlad Roubtsov, (C) 2003

Fields Summary
Constructors Summary
private ResourceLoader()

Methods Summary
public static java.net.URLgetResource(java.lang.String name)

see
java.lang.ClassLoader#getResource(java.lang.String)

        final Class caller = ClassLoaderResolver.getCallerClass (1);
        final ClassLoader loader = ClassLoaderResolver.getClassLoader (caller);
        
        if (loader != null)
            return loader.getResource (name);
        else
            return ClassLoader.getSystemResource (name);
    
public static java.net.URLgetResource(java.lang.String name, java.lang.ClassLoader loader)

        if (loader != null)
            return loader.getResource (name);
        else
            return ClassLoader.getSystemResource (name);
    
public static java.io.InputStreamgetResourceAsStream(java.lang.String name)

see
java.lang.ClassLoader#getResourceAsStream(java.lang.String)

        final Class caller = ClassLoaderResolver.getCallerClass (1);
        final ClassLoader loader = ClassLoaderResolver.getClassLoader (caller);
        
        if (loader != null)
            return loader.getResourceAsStream (name);
        else
            return ClassLoader.getSystemResourceAsStream (name);
    
public static java.io.InputStreamgetResourceAsStream(java.lang.String name, java.lang.ClassLoader loader)

        if (loader != null)
            return loader.getResourceAsStream (name);
        else
            return ClassLoader.getSystemResourceAsStream (name);
    
public static java.util.EnumerationgetResources(java.lang.String name)

see
java.lang.ClassLoader#getResources(java.lang.String)

        final Class caller = ClassLoaderResolver.getCallerClass (1);
        final ClassLoader loader = ClassLoaderResolver.getClassLoader (caller);
        
        if (loader != null)
            return loader.getResources (name);
        else
            return ClassLoader.getSystemResources (name);
    
public static java.util.EnumerationgetResources(java.lang.String name, java.lang.ClassLoader loader)

        if (loader != null)
            return loader.getResources (name);
        else
            return ClassLoader.getSystemResources (name);
    
public static java.lang.ClassloadClass(java.lang.String name)

see
java.lang.ClassLoader#loadClass(java.lang.String)

        final Class caller = ClassLoaderResolver.getCallerClass (1);
        final ClassLoader loader = ClassLoaderResolver.getClassLoader (caller);
        
        return Class.forName (name, false, loader);
    
public static java.lang.ClassloadClass(java.lang.String name, java.lang.ClassLoader loader)

        return Class.forName (name, false, loader != null ? loader : ClassLoader.getSystemClassLoader ());