@Beta public static class ClassPath.ResourceInfo extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) java.lang.ClassLoader |
loader |
private java.lang.String |
resourceName |
Constructor and Description |
---|
ResourceInfo(java.lang.String resourceName,
java.lang.ClassLoader loader) |
Modifier and Type | Method and Description |
---|---|
ByteSource |
asByteSource()
Returns a
ByteSource view of the resource from which its bytes can be read. |
CharSource |
asCharSource(java.nio.charset.Charset charset)
Returns a
CharSource view of the resource from which its bytes can be read as
characters decoded with the given charset . |
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getResourceName()
Returns the fully qualified name of the resource.
|
int |
hashCode() |
(package private) static ClassPath.ResourceInfo |
of(java.lang.String resourceName,
java.lang.ClassLoader loader) |
java.lang.String |
toString() |
java.net.URL |
url()
Returns the url identifying the resource.
|
private final java.lang.String resourceName
final java.lang.ClassLoader loader
ResourceInfo(java.lang.String resourceName, java.lang.ClassLoader loader)
static ClassPath.ResourceInfo of(java.lang.String resourceName, java.lang.ClassLoader loader)
public final java.net.URL url()
See ClassLoader.getResource(java.lang.String)
java.util.NoSuchElementException
- if the resource cannot be loaded through the class loader,
despite physically existing in the class path.public final ByteSource asByteSource()
ByteSource
view of the resource from which its bytes can be read.java.util.NoSuchElementException
- if the resource cannot be loaded through the class loader,
despite physically existing in the class path.public final CharSource asCharSource(java.nio.charset.Charset charset)
CharSource
view of the resource from which its bytes can be read as
characters decoded with the given charset
.java.util.NoSuchElementException
- if the resource cannot be loaded through the class loader,
despite physically existing in the class path.public final java.lang.String getResourceName()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object