java.lang.Object
io.smallrye.common.resource.Resource
io.smallrye.common.resource.URLResource
A resource backed by a connection to a URL.
-
Constructor Summary
ConstructorsConstructorDescriptionURLResource(String pathName, URL url) Construct a new instance for a URL.URLResource(String pathName, URLConnection connection) Construct a new instance.URLResource(JarURLConnection jarConnection) Construct a new instance for a JAR URL connection. -
Method Summary
Methods inherited from class io.smallrye.common.resource.Resource
asBuffer, asString, codeSigners, copyTo, copyTo, copyTo, isDirectory, openDirectoryStream, pathName, readStream
-
Constructor Details
-
URLResource
Construct a new instance for a URL.- Parameters:
pathName- the resource path name (must not benull)url- the URL (must not benull)- Throws:
IOException- if the connection could not be opened
-
URLResource
Construct a new instance.- Parameters:
pathName- the resource path name (must not benull)connection- the URL connection (must not benull)
-
URLResource
Construct a new instance for a JAR URL connection. The JAR entry name is used as the resource name.- Parameters:
jarConnection- the JAR URL connection (must not benull)
-
-
Method Details
-
url
Description copied from class:ResourceReturns the resource URL (notnull). If the resource location information cannot be converted to a URL, an exception may be thrown. -
openStream
Description copied from class:ResourceOpen an input stream to read this resource.- Specified by:
openStreamin classResource- Returns:
- the input stream (not
null) - Throws:
IOException- if the input stream could not be opened or the resource is a directory
-
modifiedTime
Description copied from class:ResourceReturns the modification time of the resource, ornullif the time is unknown.- Overrides:
modifiedTimein classResource- Returns:
- the modification time of the resource, or
nullif the time is unknown
-
size
public long size()Description copied from class:ResourceReturns the size of the resource, or-1if the size is not known.
-