public class CommonResources extends Object
| Modifier and Type | Field and Description |
|---|---|
static Logger |
CURLOG |
static URL[] |
URL_ARRAY_MODEL |
| Constructor and Description |
|---|
CommonResources() |
| Modifier and Type | Method and Description |
|---|---|
static Properties |
gatherAllPropertiesFrom(ClassLoader loader,
String loaderResourceName)
this method will create a Properties object filled with ALL the ".properties" resources
and Files that happen to bear the same name in the ClassPath and in the current directory.
|
static Properties |
gatherAllPropertiesFrom(String loaderResourceName)
same as the method with a ClassLoader argument but uses the current ClassLoader
|
static String[] |
getClassURLNamesFor(Object obj)
get the names of places where a Class lies in the classPath
|
static InputStream |
getInput(Class clazz,
String pathName)
searches for a file as a local file or a resource linked to a class or a global resource.
|
static Manifest |
getManifestFor(Object obj)
returns a Manifest for an object
|
static Properties |
getPropertiesFrom(URL url)
fills a Property Object from an URL the references a file in ".properties" format
|
static Properties |
getPropertiesFromAny(String name) |
static String |
getResourceContainer(URL url,
String commonResourceName)
gets the name of a jar that contains a "common resource"
|
static URL[] |
getURLsFor(Object obj,
String commonResourceName)
return the URL of a resource that lies in the same jar as a class.
|
static URL[] |
getURLsFrom(ClassLoader loader,
String commonResourceName)
As "seen" from a ClassLoader the various URLs that point to resources with a given name.
|
static URL[] |
getURLsFrom(String commonResourceName)
As "seen" from the context ClassLoader the various URLs that point to resources with a given name
|
public static final URL[] URL_ARRAY_MODEL
public static final Logger CURLOG
public static URL[] getURLsFrom(ClassLoader loader, String commonResourceName)
loader - a current ClassLoadercommonResourceName - name of resource (without initial slash!)public static URL[] getURLsFrom(String commonResourceName)
commonResourceName - name of resource (without initial slash!)public static URL[] getURLsFor(Object obj, String commonResourceName)
obj - any instance of a Class object if no instance is at handcommonResourceName - name of resource (without initial slash!)public static String[] getClassURLNamesFor(Object obj)
obj - any object or Classpublic static Properties getPropertiesFrom(URL url)
url - public static String getResourceContainer(URL url, String commonResourceName)
url - commonResourceName - name of resource (without initial slash!)public static Manifest getManifestFor(Object obj)
obj - an object instance or a Classpublic static InputStream getInput(Class clazz, String pathName) throws IOException
clazz - pathName - IOExceptionpublic static Properties getPropertiesFromAny(String name)
name - public static Properties gatherAllPropertiesFrom(ClassLoader loader, String loaderResourceName)
loader - ClassLoaderloaderResourceName - the name of the Resource according to ClassLoader conventions
(this means that the usual ResourceName with Objects should not be used)public static Properties gatherAllPropertiesFrom(String loaderResourceName)
loaderResourceName - file name or resource name that uses the ClassLoader resource naming conventionCopyright © 2024 LSST. All rights reserved.