|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.arakhne.vmutil.Resources
public class Resources
This utility class provides to load resources according to several heuristics:
| Field Summary | |
|---|---|
static String |
NAME_SEPARATOR
Character used to separate paths on an resource name. |
| Constructor Summary | |
|---|---|
Resources()
|
|
| Method Summary | |
|---|---|
static URL |
getResource(Class<?> classname,
String path)
Replies the URL of a resource. |
static URL |
getResource(ClassLoader classLoader,
Package packagename,
String path)
Replies the URL of a resource. |
static URL |
getResource(ClassLoader classLoader,
String path)
Replies the URL of a resource. |
static URL |
getResource(String path)
Replies the URL of a resource. |
static InputStream |
getResourceAsStream(Class<?> classname,
String path)
Replies the input stream of a resource. |
static InputStream |
getResourceAsStream(ClassLoader classLoader,
Package packagename,
String path)
Replies the input stream of a resource. |
static InputStream |
getResourceAsStream(ClassLoader classLoader,
String path)
Replies the input stream of a resource. |
static InputStream |
getResourceAsStream(String path)
Replies the input stream of a resource. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String NAME_SEPARATOR
| Constructor Detail |
|---|
public Resources()
| Method Detail |
|---|
public static URL getResource(String path)
You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames.
The class loader replied by ClassLoaderFinder is used.
If it is null, the class loader of
the Resources class is used.
path - is the absolute path of the resource.
null if the resource was
not found in class paths.
public static URL getResource(ClassLoader classLoader,
Package packagename,
String path)
You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames.
The name of packagename is translated into a resource path (by replacing the dots by slashes) and the given path is append to. For example, the two following codes are equivalent:
Resources.getResources(Package.getPackage("org.arakhne.afc"), "/a/b/c/d.png");
Resources.getResources("org/arakhne/afc/a/b/c/d.png");
If the classLoader parameter is null,
the class loader replied by ClassLoaderFinder is used.
If this last is null, the class loader of
the Resources class is used.
classLoader - is the research scope. If null,
the class loader replied by ClassLoaderFinder is used.packagename - is the package in which the resource should be located.path - is the relative path of the resource in the package.
null if the resource was
not found in class paths.
public static URL getResource(Class<?> classname,
String path)
You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames.
The name of classname is translated into a resource path (by remove the name of the class and replacing the dots by slashes) and the given path is append to. For example, the two following codes are equivalent:
Resources.getResources(Resources.class, "/a/b/c/d.png");
Resources.getResources("org/arakhne/vmutil/a/b/c/d.png");
The class loader of the given class is used. If it is null,
the class loader replied by ClassLoaderFinder is used.
If it is also null, the class loader of this Resources
class is used.
classname - is located in the package in which the resource should be also located.path - is the absolute path of the resource.
null if the resource was
not found in class paths.
public static URL getResource(ClassLoader classLoader,
String path)
You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames.
If the classLoader parameter is null,
the class loader replied by ClassLoaderFinder is used.
If this last is null, the class loader of
the Resources class is used.
classLoader - is the research scope. If null,
the class loader replied by ClassLoaderFinder is used.path - is the absolute path of the resource.
null if the resource was
not found in class paths.public static InputStream getResourceAsStream(String path)
You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames, and may not start the path with a slash.
The class loader replied by ClassLoaderFinder is used.
If it is null, the class loader of
the Resources class is used.
path - is the absolute path of the resource.
null if the resource was
not found in class paths.
public static InputStream getResourceAsStream(ClassLoader classLoader,
Package packagename,
String path)
You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames.
The name of packagename is translated into a resource path (by replacing the dots by slashes) and the given path is append to. For example, the two following codes are equivalent:
Resources.getResources(Package.getPackage("org.arakhne.afc"), "/a/b/c/d.png");
Resources.getResources("org/arakhne/afc/a/b/c/d.png");
If the classLoader parameter is null,
the class loader replied by ClassLoaderFinder is used.
If this last is null, the class loader of
the Resources class is used.
classLoader - is the research scope. If null,
the class loader replied by ClassLoaderFinder is used.packagename - is the package in which the resource should be located.path - is the relative path of the resource in the package.
null if the resource was
not found in class paths.
public static InputStream getResourceAsStream(Class<?> classname,
String path)
You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames.
The name of classname is translated into a resource path (by remove the name of the class and replacing the dots by slashes) and the given path is append to. For example, the two following codes are equivalent:
Resources.getResources(Resources.class, "/a/b/c/d.png");
Resources.getResources("org/arakhne/vmutil/a/b/c/d.png");
The class loader of the given class is used. If it is null,
the class loader replied by ClassLoaderFinder is used.
If it is also null, the class loader of this Resources
class is used.
classname - is located in the package in which the resource should be also located.path - is the absolute path of the resource.
null if the resource was
not found in class paths.
public static InputStream getResourceAsStream(ClassLoader classLoader,
String path)
You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames, and may not start the path with a slash.
If the classLoader parameter is null,
the class loader replied by ClassLoaderFinder is used.
If this last is null, the class loader of
the Resources class is used.
classLoader - is the research scope. If null,
the class loader replied by ClassLoaderFinder is used.path - is the absolute path of the resource.
null if the resource was
not found in class paths.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||