Class ClassPath.ResourceInfo

java.lang.Object
dev.mccue.guava.reflect.ClassPath.ResourceInfo
Direct Known Subclasses:
ClassPath.ClassInfo
Enclosing class:
ClassPath

public static class ClassPath.ResourceInfo extends Object
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
  • Method Summary

    Modifier and Type
    Method
    Description
    final dev.mccue.guava.io.ByteSource
    Returns a ByteSource view of the resource from which its bytes can be read.
    final dev.mccue.guava.io.CharSource
    Returns a CharSource view of the resource from which its bytes can be read as characters decoded with the given charset.
    boolean
     
    final String
    Returns the fully qualified name of the resource.
    int
     
     
    final URL
    url()
    Returns the url identifying the resource.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • url

      public final URL url()
      Returns the url identifying the resource.

      See ClassLoader.getResource(java.lang.String)

      Throws:
      NoSuchElementException - if the resource cannot be loaded through the class loader, despite physically existing in the class path.
    • asByteSource

      public final dev.mccue.guava.io.ByteSource asByteSource()
      Returns a ByteSource view 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

      public final dev.mccue.guava.io.CharSource asCharSource(Charset charset)
      Returns a CharSource view of the resource from which its bytes can be read as characters decoded with the given charset.
      Throws:
      NoSuchElementException - if the resource cannot be loaded through the class loader, despite physically existing in the class path.
      Since:
      20.0
    • getResourceName

      public final String getResourceName()
      Returns the fully qualified name of the resource. Such as "com/mycomp/foo/bar.txt".
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(@CheckForNull Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object