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 java.util.Collection<ResourcePath>
find(java.lang.String pathPrefix, java.util.function.Predicate<java.lang.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.java.util.stream.Stream<Resource>
streamAll(ResourcePath path)
Loads all theresources
at the given path from all activepack contents
.
-
-
-
Method Detail
-
load
Resource load(ResourcePath path) throws java.io.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:
java.io.IOException
- If the resource could not be readjava.io.FileNotFoundException
- If the file does not exist
-
streamAll
java.util.stream.Stream<Resource> streamAll(ResourcePath path) throws java.io.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:
java.io.IOException
- If a resource could not be readjava.io.FileNotFoundException
- If there are no resources at the path
-
find
java.util.Collection<ResourcePath> find(java.lang.String pathPrefix, java.util.function.Predicate<java.lang.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
-
-