public final class ClassLoaderUtils extends Object
Modifier and Type | Method and Description |
---|---|
static URL |
getResource(String resourceName,
Class<?> callingClass)
Load a given resource.
|
static InputStream |
getResourceAsStream(String resourceName,
Class<?> callingClass)
This is a convenience method to load a resource as a stream.
|
static List<URL> |
getResources(String resourceName,
Class<?> callingClass)
Load a given resources.
|
static Class<?> |
loadClass(String className,
Class<?> callingClass)
Load a class with a given name.
|
public static URL getResource(String resourceName, Class<?> callingClass)
resourceName
- The name of the resource to loadcallingClass
- The Class object of the calling objectpublic static List<URL> getResources(String resourceName, Class<?> callingClass)
resourceName
- The name of the resource to loadcallingClass
- The Class object of the calling objectpublic static InputStream getResourceAsStream(String resourceName, Class<?> callingClass)
resourceName
- The name of the resource to loadcallingClass
- The Class object of the calling objectpublic static Class<?> loadClass(String className, Class<?> callingClass) throws ClassNotFoundException
className
- The name of the class to loadcallingClass
- The Class object of the calling objectClassNotFoundException
- If the class cannot be found anywhere.Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.