ConfigurationSource.Resource (Apache Tomcat 9.0.120 API Documentation)
Description: declaration: package: org.apache.tomcat.util.file, interface: ConfigurationSource, class: Resource

# Class ConfigurationSource.Resource

java.lang.Object
org.apache.tomcat.util.file.ConfigurationSource.Resource

All Implemented Interfaces:
  `AutoCloseable`

Enclosing interface:
  `ConfigurationSource`

public static class ConfigurationSource.Resource extends Object implements AutoCloseable
Represents a resource: a stream to the resource associated with its URI.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Resource(InputStream inputStream, URI uri)`
  Creates a new resource with the given input stream and URI.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `InputStream`
  `getInputStream()`
  Returns the input stream for reading the resource content.
  `long`
  `getLastModified()`
  Returns the last modified time of the resource in milliseconds since the epoch.
  `URI`
  `getURI()`
  Returns the URI that identifies the resource location.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Resource

    public Resource(InputStream inputStream, URI uri)
    Creates a new resource with the given input stream and URI.
    Parameters:
      `inputStream` - the input stream for the resource content
      `uri` - the URI identifying the resource location

- ## Method Details

  - ### getInputStream

    public InputStream getInputStream()
    Returns the input stream for reading the resource content.
    Returns:
      the input stream

  - ### getURI

    public URI getURI()
    Returns the URI that identifies the resource location.
    Returns:
      the resource URI

  - ### getLastModified

    public long getLastModified() throws MalformedURLException, IOException
    Returns the last modified time of the resource in milliseconds since the epoch.
    Returns:
      the last modified time in milliseconds
    Throws:
      `MalformedURLException` - if the resource URI cannot be converted to a URL
      `IOException` - if an I/O error occurs while fetching the last modified time

  - ### close

    public void close() throws IOException
    Specified by:
      `close` in interface `AutoCloseable`
    Throws:
      `IOException`