Top Description Fields Constructors Methods
io.smallrye.common.resource

public final Class URLResourceLoader

extends Object
implements ResourceLoader
Class Inheritance
All Implemented Interfaces
io.smallrye.common.resource.ResourceLoader, java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.IOException, java.net.URL, io.smallrye.common.constraint.Assert

A resource loader for a URL base.

Field Summary

Modifier and TypeField and Description
private final URL

Constructor Summary

AccessConstructor and Description
public
URLResourceLoader(final URL
the URL base (must not be null)
base
)

Construct a new instance

Note

to open a JAR file, use JarFileResourceLoader instead.

Method Summary

Modifier and TypeMethod and Description
public URL
baseUrl()

Overrides default io.smallrye.common.resource.ResourceLoader.baseUrl.

Returns the base URL for this loader.

public Resource
findResource(final String
the resource path (must not be null)
path
)

Implements io.smallrye.common.resource.ResourceLoader.findResource.

Find a resource from this loader.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

baseback to summary
private final URL base

Constructor Detail

URLResourceLoaderback to summary
public URLResourceLoader(final 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:URL

the URL base (must not be null)

Method Detail

baseUrlback to summary
public URL baseUrl()

Overrides default io.smallrye.common.resource.ResourceLoader.baseUrl.

Doc from io.smallrye.common.resource.ResourceLoader.baseUrl.

Returns the base URL for this loader.

Returns:URL

the base URL for this loader

findResourceback to summary
public Resource findResource(final String path) throws IOException

Implements io.smallrye.common.resource.ResourceLoader.findResource.

Doc from io.smallrye.common.resource.ResourceLoader.findResource.

Find a resource from this loader.

Parameters
path:String

the resource path (must not be null)

Returns:Resource

the loaded resource, or null if no resource is found at the given path

Exceptions
IOException:
if the resource could not be loaded