Interface Resource

    • Method Detail

      • of

        static Resource of​(java.lang.String name,
                           java.net.URI uri)
        Create a new Resource with the given name and URI.
        Parameters:
        name - the name of the resource; never null
        uri - the URI of the resource; never null
        Returns:
        a new Resource
        Since:
        1.14
      • getName

        java.lang.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

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

        default java.io.InputStream getInputStream()
                                            throws java.io.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:
        java.io.IOException - if an I/O exception occurs