Interface ResourceManager


  • public interface ResourceManager
    The resource manager is in charge of loading Resources.

    Packs are stacked on top of each other, so they will override and replace resources in packs which are a lower priority.

    • Method Detail

      • load

        Resource load​(ResourcePath path)
               throws java.io.IOException
        Loads the resource 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 read
        java.io.FileNotFoundException - If the file does not exist
      • streamAll

        java.util.stream.Stream<Resource> streamAll​(ResourcePath path)
                                             throws java.io.IOException
        Loads all the resources at the given path from all active pack 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 read
        java.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 the resource paths from all namespaces with the given path prefix and matches the filter Predicate.
        Parameters:
        pathPrefix - The prefix of the paths
        pathFilter - The filter all paths must pass
        Returns:
        The list of matching paths