Class ResourceWithMetadata

java.lang.Object
net.solarnetwork.io.ResourceWithMetadata
All Implemented Interfaces:
ResourceMetadataHolder, org.springframework.core.io.InputStreamSource, org.springframework.core.io.Resource

public class ResourceWithMetadata extends Object implements org.springframework.core.io.Resource, ResourceMetadataHolder
A Resource and ResourceMetadataHolder combination, to allow ResourceMetadata to be associated with a Resource.
Since:
1.54
Version:
1.0
Author:
matt
  • Constructor Details

    • ResourceWithMetadata

      public ResourceWithMetadata(org.springframework.core.io.Resource delegate, ResourceMetadata metadata)
      Constructor.
      Parameters:
      delegate - the delegate resource
      metadata - the associated metadata
  • Method Details

    • getMetadata

      public ResourceMetadata getMetadata()
      Description copied from interface: ResourceMetadataHolder
      Get the resource metadata.
      Specified by:
      getMetadata in interface ResourceMetadataHolder
      Returns:
      the metadata, or null if not available
    • getInputStream

      public InputStream getInputStream() throws IOException
      Specified by:
      getInputStream in interface org.springframework.core.io.InputStreamSource
      Throws:
      IOException
    • exists

      public boolean exists()
      Specified by:
      exists in interface org.springframework.core.io.Resource
    • isReadable

      public boolean isReadable()
      Specified by:
      isReadable in interface org.springframework.core.io.Resource
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface org.springframework.core.io.Resource
    • getURL

      public URL getURL() throws IOException
      Specified by:
      getURL in interface org.springframework.core.io.Resource
      Throws:
      IOException
    • getURI

      public URI getURI() throws IOException
      Specified by:
      getURI in interface org.springframework.core.io.Resource
      Throws:
      IOException
    • getFile

      public File getFile() throws IOException
      Specified by:
      getFile in interface org.springframework.core.io.Resource
      Throws:
      IOException
    • contentLength

      public long contentLength() throws IOException
      Specified by:
      contentLength in interface org.springframework.core.io.Resource
      Throws:
      IOException
    • lastModified

      public long lastModified() throws IOException
      Specified by:
      lastModified in interface org.springframework.core.io.Resource
      Throws:
      IOException
    • createRelative

      public org.springframework.core.io.Resource createRelative(String relativePath) throws IOException
      Specified by:
      createRelative in interface org.springframework.core.io.Resource
      Throws:
      IOException
    • getFilename

      public String getFilename()
      Specified by:
      getFilename in interface org.springframework.core.io.Resource
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface org.springframework.core.io.Resource