Package com.jme3.util.res
Class Resources
java.lang.Object
com.jme3.util.res.Resources
This class is used to load resources from the default location usually the
classpath.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The property name to set the ResourceLoader to use. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic URL
getResource
(String path) Finds the resource with the given name.static URL
getResource
(String path, Class<?> parent) Finds the resource with the given name relative to the given parent class or to the root if the parent is null.static InputStream
getResourceAsStream
(String path) Finds the resource with the given name.static InputStream
getResourceAsStream
(String path, Class<?> parent) Finds the resource with the given name relative to the given parent class or to the root if the parent is null.static Enumeration<URL>
getResources
(String path) Finds all resources with the given name.static void
Sets the resource loader implementation to use.
-
Field Details
-
PROPERTY_RESOURCE_LOADER_IMPLEMENTATION
The property name to set the ResourceLoader to use. Should be set automatically by the JmeSystemDelegate. Note: changing this property after the first use of the ResourceLoader will have no effect.- See Also:
-
-
Constructor Details
-
Resources
public Resources()
-
-
Method Details
-
setResourceLoader
Sets the resource loader implementation to use.- Parameters:
impl
- The resource loader implementation
-
getResource
Finds the resource with the given name.- Parameters:
path
- The resource name- Returns:
- The resource URL or null if not found
-
getResource
Finds the resource with the given name relative to the given parent class or to the root if the parent is null.- Parameters:
path
- The resource nameparent
- Optional parent class- Returns:
- The resource URL or null if not found
-
getResourceAsStream
Finds the resource with the given name.- Parameters:
path
- The resource name- Returns:
- An input stream to the resource or null if not found
-
getResourceAsStream
Finds the resource with the given name relative to the given parent class or to the root if the parent is null.- Parameters:
path
- The resource nameparent
- Optional parent class- Returns:
- An input stream to the resource or null if not found
-
getResources
Finds all resources with the given name.- Parameters:
path
- The resource name- Returns:
- An enumeration of
objects for the resource. If no resources could be found, the enumeration will be empty.URL
- Throws:
IOException
- If I/O errors occurIOException
-