Package com.google.common.reflect
Class ClassPath.ResourceInfo
java.lang.Object
com.google.common.reflect.ClassPath.ResourceInfo
- Direct Known Subclasses:
ClassPath.ClassInfo
- Enclosing class:
- ClassPath
Represents a class path resource that can be either a class file or any other resource file
loadable from the class path.
- Since:
- 14.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final File(package private) final ClassLoaderprivate final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ByteSourceReturns aByteSourceview of the resource from which its bytes can be read.final CharSourceasCharSource(Charset charset) Returns aCharSourceview of the resource from which its bytes can be read as characters decoded with the givencharset.boolean(package private) final FilegetFile()Returns the file that includes this resource.final StringReturns the fully qualified name of the resource.inthashCode()(package private) static ClassPath.ResourceInfoof(File file, String resourceName, ClassLoader loader) toString()final URLurl()Returns the url identifying the resource.
-
Field Details
-
file
-
resourceName
-
loader
-
-
Constructor Details
-
ResourceInfo
ResourceInfo(File file, String resourceName, ClassLoader loader)
-
-
Method Details
-
of
-
url
Returns the url identifying the resource.- Throws:
NoSuchElementException- if the resource cannot be loaded through the class loader, despite physically existing in the class path.
-
asByteSource
Returns aByteSourceview of the resource from which its bytes can be read.- Throws:
NoSuchElementException- if the resource cannot be loaded through the class loader, despite physically existing in the class path.- Since:
- 20.0
-
asCharSource
Returns aCharSourceview of the resource from which its bytes can be read as characters decoded with the givencharset.- Throws:
NoSuchElementException- if the resource cannot be loaded through the class loader, despite physically existing in the class path.- Since:
- 20.0
-
getResourceName
Returns the fully qualified name of the resource. Such as "com/mycomp/foo/bar.txt". -
getFile
Returns the file that includes this resource. -
hashCode
public int hashCode() -
equals
-
toString
-