Interface ResourceLoader

All Known Implementing Classes:
WorldEditResourceLoader

public interface ResourceLoader
An abstract loader that handles loading resources from bundled URLs or local files.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the Path reference to this local resource.
    default URL
    getResource(Class<?> clazz, String pathName)
    Gets the bundled resource URL by name, relative to the provided class.
    default URL
    Gets the bundled resource URL by name.
  • Method Details

    • getResource

      @Nullable default URL getResource(Class<?> clazz, String pathName) throws IOException
      Gets the bundled resource URL by name, relative to the provided class.

      The path name must not start with /.

      Parameters:
      clazz - The class to search relative to
      pathName - The path name
      Returns:
      The URL to this bundled resource
      Throws:
      IOException - if an IO issue occurs
    • getRootResource

      @Nullable default URL getRootResource(String pathName) throws IOException
      Gets the bundled resource URL by name.

      The path name must not start with /. It is always absolute.

      Parameters:
      pathName - The path name
      Returns:
      The URL to this bundled resource
      Throws:
      IOException - if an IO issue occurs
    • getLocalResource

      Path getLocalResource(String pathName)
      Gets the Path reference to this local resource. The file may not exist.
      Parameters:
      pathName - The path name
      Returns:
      The path reference