Package org.spongepowered.api.resource
Interface ResourceManager
-
public interface ResourceManager
The resource manager is in charge of loadingResources
.Packs are stacked on top of each other, so they will override and replace resources in packs which are a lower priority.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Collection<ResourcePath>
find(String pathPrefix, Predicate<String> pathFilter)
Finds all theresource paths
from all namespaces with the given path prefix and matches the filterPredicate
.Resource
load(ResourcePath path)
Loads theresource
at the given path, or throws an exception if it doesn't exist.Stream<Resource>
streamAll(ResourcePath path)
Loads all theresources
at the given path from all activepack contents
.
-
-
-
Method Detail
-
load
Resource load(ResourcePath path) throws IOException
Loads theresource
at the given path, or throws an exception if it doesn't exist.- Parameters:
path
- The path to the resource- Returns:
- The resource
- Throws:
IOException
- If the resource could not be readFileNotFoundException
- If the file does not exist
-
streamAll
Stream<Resource> streamAll(ResourcePath path) throws IOException
Loads all theresources
at the given path from all activepack contents
.- Parameters:
path
- The path to the resource- Returns:
- The list of all resources at the path
- Throws:
IOException
- If a resource could not be readFileNotFoundException
- If there are no resources at the path
-
find
Collection<ResourcePath> find(String pathPrefix, Predicate<String> pathFilter)
Finds all theresource paths
from all namespaces with the given path prefix and matches the filterPredicate
.- Parameters:
pathPrefix
- The prefix of the pathspathFilter
- The filter all paths must pass- Returns:
- The list of matching paths
-
-