Interface Resource


public interface Resource
Describe a resource, such as a file or class path resource.
  • Method Details

    • getScheme

      String getScheme()
      The scheme of the resource such as file, classpath, http
    • getLocation

      String getLocation()
      The location of the resource.
    • exists

      boolean exists()
      Whether this resource exists.
    • getURI

      default URI getURI()
      The URI of the resource.

      The default implementation creates a URI object from resource location.
    • getURL

      default URL getURL() throws MalformedURLException
      The URL for the resource or null if the URL can not be computed.

      The default implementation creates a URI object from resource location.
      Throws:
      MalformedURLException
    • getInputStream

      InputStream getInputStream() throws IOException
      Returns an InputStream that reads from the underlying resource.

      Each invocation must return a new InputStream instance.
      Throws:
      IOException
    • getReader

      default Reader getReader() throws Exception
      Returns a Reader that reads from the underlying resource using UTF-8 as charset.

      Each invocation must return a new Reader.
      Throws:
      Exception
      See Also:
    • getReader

      default Reader getReader(Charset charset) throws Exception
      Returns a Reader that reads from the underlying resource using the given Charset

      Each invocation must return a new Reader.
      Throws:
      Exception
      See Also: