Class URLResourceLoader

java.lang.Object
io.smallrye.common.resource.URLResourceLoader
All Implemented Interfaces:
ResourceLoader, Closeable, AutoCloseable

public final class URLResourceLoader extends Object implements ResourceLoader
A resource loader for a URL base.
  • Constructor Details

    • URLResourceLoader

      public URLResourceLoader(URL base)
      Construct a new instance. Note: to open a JAR file, use JarFileResourceLoader instead. To access files on the file system, use PathResourceLoader instead.
      Parameters:
      base - the URL base (must not be null)
  • Method Details

    • findResource

      public Resource findResource(String path) throws IOException
      Description copied from interface: ResourceLoader
      Find a resource from this loader.
      Specified by:
      findResource in interface ResourceLoader
      Parameters:
      path - the resource path (must not be null)
      Returns:
      the loaded resource, or null if no resource is found at the given path
      Throws:
      IOException - if the resource could not be loaded
    • baseUrl

      public URL baseUrl()
      Description copied from interface: ResourceLoader
      Returns the base URL for this loader.
      Specified by:
      baseUrl in interface ResourceLoader
      Returns:
      the base URL for this loader