|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.lsst.ccs.utilities.jars.CommonResources
public class CommonResources
This class deals with "common resources": that is resources that are not linked to a specific package (such resources are often queried using an initial slash when querying a resource through the Class resource methods such as getResource : getResource("/global.properties")).
Beware: in the codeusing this class these resource names should not start with a slash (same protocol as with the ClassLoader resource methods. The general idea is that when dealing with multiple jars there may be many "common resources" with the same name.
| Field Summary | |
|---|---|
static Logger |
CURLOG
|
static URL[] |
URL_ARRAY_MODEL
|
| Constructor Summary | |
|---|---|
CommonResources()
|
|
| Method Summary | |
|---|---|
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 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final URL[] URL_ARRAY_MODEL
public static final Logger CURLOG
| Constructor Detail |
|---|
public CommonResources()
| Method Detail |
|---|
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 Class
public 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 Class
public 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 convention
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||