All Known Implementing Classes:
DefaultResource

@API(status=EXPERIMENTAL, since="1.11") public interface Resource
Resource represents a resource on the classpath.
Since:
1.11
See Also:
  • Method Details

    • getName

      String getName()
      Get the name of this resource.

      The resource name is a /-separated path. The path is relative to the classpath root in which the resource is located.

      Returns:
      the resource name; never null
    • getUri

      URI getUri()
      Get the URI of this resource.
      Returns:
      the uri of the resource; never null
    • getInputStream

      default InputStream getInputStream() throws IOException
      Get an InputStream for reading this resource.

      The default implementation delegates to URL.openStream() for this resource's URI.

      Returns:
      an input stream for this resource; never null
      Throws:
      IOException - if an I/O exception occurs