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

public final Class JarFileResource

extends Resource
Class Inheritance
Imports
java.io.IOException, .InputStream, java.net.MalformedURLException, .URI, .URISyntaxException, .URL, java.nio.file.DirectoryStream, java.nio.file.attribute.FileTime, java.security.CodeSigner, java.time.Instant, java.util.Iterator, .List, java.util.jar.JarEntry, .JarFile

A resource representing an entry in a JAR file.

Field Summary

Modifier and TypeField and Description
private final URL
private final JarEntry
private final JarFile
private URL

Constructor Summary

AccessConstructor and Description
pack-priv
JarFileResource(final URL base, final JarFile jarFile, final JarEntry jarEntry)

Method Summary

Modifier and TypeMethod and Description
public List<CodeSigner>
codeSigners()

Overrides io.smallrye.common.resource.Resource.codeSigners.

Returns the list of code signers for this resource.

public boolean
isDirectory()

Overrides io.smallrye.common.resource.Resource.isDirectory.

Returns true if this resource represents a directory, or false otherwise.

public Instant
modifiedTime()

Overrides io.smallrye.common.resource.Resource.modifiedTime.

Returns the modification time of the resource, or null if the time is unknown.

public DirectoryStream<Resource>
openDirectoryStream()

Overrides io.smallrye.common.resource.Resource.openDirectoryStream.

Open a directory stream to read the contents of this directory.

public InputStream
openStream()

Implements abstract io.smallrye.common.resource.Resource.openStream.

Open an input stream to read this resource.

public long
size()

Implements abstract io.smallrye.common.resource.Resource.size.

Returns the size of the resource, or -1 if the size is not known.

public URL
url()

Implements abstract io.smallrye.common.resource.Resource.url.

Returns the resource URL (not null).

Inherited from io.smallrye.common.resource.Resource:
asBufferasStringcopyTocopyTocopyTopathNamereadStream

Field Detail

baseback to summary
private final URL base
jarEntryback to summary
private final JarEntry jarEntry
jarFileback to summary
private final JarFile jarFile
urlback to summary
private URL url

Constructor Detail

JarFileResourceback to summary
pack-priv JarFileResource(final URL base, final JarFile jarFile, final JarEntry jarEntry)

Method Detail

codeSignersback to summary
public List<CodeSigner> codeSigners()

Overrides io.smallrye.common.resource.Resource.codeSigners.

Doc from io.smallrye.common.resource.Resource.codeSigners.

Returns the list of code signers for this resource. The resource must have been fully read, or else consumed as a buffer. By default, the base implementation returns an empty list.

Returns:List<CodeSigner>

the list of code signers for this resource

isDirectoryback to summary
public boolean isDirectory()

Overrides io.smallrye.common.resource.Resource.isDirectory.

Doc from io.smallrye.common.resource.Resource.isDirectory.

Returns true if this resource represents a directory, or false otherwise. Not every resource implementation supports directory access.

Returns:boolean

true if this resource represents a directory, or false otherwise

modifiedTimeback to summary
public Instant modifiedTime()

Overrides io.smallrye.common.resource.Resource.modifiedTime.

Doc from io.smallrye.common.resource.Resource.modifiedTime.

Returns the modification time of the resource, or null if the time is unknown.

Returns:Instant

the modification time of the resource, or null if the time is unknown

openDirectoryStreamback to summary
public DirectoryStream<Resource> openDirectoryStream() throws IOException

Overrides io.smallrye.common.resource.Resource.openDirectoryStream.

Doc from io.smallrye.common.resource.Resource.openDirectoryStream.

Open a directory stream to read the contents of this directory. Not every resource implementation supports directory access.

Returns:DirectoryStream<Resource>

the directory stream (not null)

Exceptions
IOException:
if the directory could not be opened or the resource is not a directory
openStreamback to summary
public InputStream openStream() throws IOException

Implements abstract io.smallrye.common.resource.Resource.openStream.

Doc from io.smallrye.common.resource.Resource.openStream.

Open an input stream to read this resource.

Returns:InputStream

the input stream (not null)

Exceptions
IOException:
if the input stream could not be opened or the resource is a directory
sizeback to summary
public long size()

Implements abstract io.smallrye.common.resource.Resource.size.

Doc from io.smallrye.common.resource.Resource.size.

Returns the size of the resource, or -1 if the size is not known.

Returns:long

the size of the resource, or -1 if the size is not known

urlback to summary
public URL url()

Implements abstract io.smallrye.common.resource.Resource.url.

Doc from io.smallrye.common.resource.Resource.url.

Returns the resource URL (not null). If the resource location information cannot be converted to a URL, an exception may be thrown.

Returns:URL

the resource URL (not null)