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

public final Class PathResourceLoader

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

A resource loader which loads resources from a base path.

Field Summary

Modifier and TypeField and Description
private final Path
private Closeable
c

Constructor Summary

AccessConstructor and Description
public
PathResourceLoader(final Path
the base path (must not be null)
base
)

Construct a new instance

Note

to open a JAR file, use JarFileResourceLoader instead.

public
PathResourceLoader(final FileSystem
the filesystem (must not be null)
fs
)

Construct a new instance from a filesystem's root.

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 void
close()

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

Release any system resources or allocations associated with this resource 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 Path base
cback to summary
private Closeable c

Constructor Detail

PathResourceLoaderback to summary
public PathResourceLoader(final Path base)

Construct a new instance

Note

to open a JAR file, use JarFileResourceLoader instead.

Parameters
base:Path

the base path (must not be null)

PathResourceLoaderback to summary
public PathResourceLoader(final FileSystem fs)

Construct a new instance from a filesystem's root. The filesystem is closed when this resource loader is closed

Note

to open a JAR file, use JarFileResourceLoader instead.

Parameters
fs:FileSystem

the filesystem (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

closeback to summary
public void close()

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

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

Release any system resources or allocations associated with this resource loader.

findResourceback to summary
public Resource findResource(final String path)

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