Package org.spongepowered.api.resource
Interface ResourceManager
-
public interface ResourceManagerThe 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 pathsfrom all namespaces with the given path prefix and matches the filterPredicate.Resourceload(ResourcePath path)Loads theresourceat the given path, or throws an exception if it doesn't exist.Stream<Resource>streamAll(ResourcePath path)Loads all theresourcesat the given path from all activepack contents.
-
-
-
Method Detail
-
load
Resource load(ResourcePath path) throws IOException
Loads theresourceat 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 theresourcesat 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 pathsfrom 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
-
-