Java Utililty Methods Class Loader

List of utility methods to do Class Loader

Description

The list of methods to do Class Loader are organized into topic(s).

Method

InputStreamgetStreamForPath(ClassLoader loader, String path)
get Stream For Path
URL url = loader.getResource(path);
if (url == null) {
    return null;
if (url.getProtocol().equals("file")) {
    try {
        return new FileInputStream(new File(url.toURI()));
    } catch (URISyntaxException e) {
...
ClassLoadergetToolsClassLoader()
get Tools Class Loader
ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
return new URLClassLoader(new URL[] { getToolsJarUrl() }, systemClassLoader);
booleanisBizServicesLocatorXmlLoaded(File f, ClassLoader classLoader)
is Biz Services Locator Xml Loaded
if ((f == null) || (!f.exists())) {
    return false;
File biz = new File(f.getAbsolutePath() + "/biz");
if (!biz.exists()) {
    System.err.println("Path not exists:" + biz);
final List<String> filenames = new ArrayList<String>();
...
Set>load(Class serviceClass, ClassLoader loader)
load
String serviceFile = SERVICES + "/" + serviceClass.getName();
LinkedHashSet<Class<? extends T>> providers = new LinkedHashSet<Class<? extends T>>();
LinkedHashSet<Class<? extends T>> vetoedProviders = new LinkedHashSet<Class<? extends T>>();
try {
    Enumeration<URL> enumeration = loader.getResources(serviceFile);
    while (enumeration.hasMoreElements()) {
        final URL url = enumeration.nextElement();
        final InputStream is = url.openStream();
...
Classload(String className)
load
return Class.forName(className);
Classload(String path, String className)
load
Class<?> clazz = classMap.get(className);
if (clazz == null) {
    clazz = doLoad(path, className);
    if (clazz != null) {
        classMap.put(className, clazz);
return clazz;
...
ListloadAllAutoConfigFiles(ClassLoader classloader)
load All Auto Config Files
List<URL> urlList = new ArrayList<URL>();
urlList.addAll(loadAutoConfigFiles(classloader, "META-INF/autoconf/auto-config.xml"));
urlList.addAll(loadAutoConfigFiles(classloader, "META-INF/auto-config.xml"));
return urlList;
ClassloadArrayClass(ClassLoader cl, String aName)
load Array Class
Class<?> componentType = null;
int[] dimensions = null;
int dot = 0;
while (componentType == null) {
    char dotChar = aName.charAt(dot);
    if (dotChar == '[') {
        dot++;
        continue;
...
ClassloadClass(ClassLoader cl, String cName)
Loads the class from the given classloader or returns null (does not throw).
if (cName.startsWith("[")) {
    return loadArrayClass(cl, cName);
try {
    return cl.loadClass(cName);
} catch (Throwable th) {
    return null;
ClassloadClass(final File baseFolder, final String qualifiedType)
load Class
try {
    return getClassLoaderForDirectory(baseFolder).loadClass(qualifiedType);
} catch (ClassNotFoundException | MalformedURLException e) {
    throw new IllegalStateException(e);