Class ConcatenatingResource

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

public class ConcatenatingResource extends org.springframework.core.io.AbstractResource implements org.springframework.core.io.Resource
A collection of resources concatenated together into one virtual resource.

The InputStream returned by this resource will be a concatenating stream of all the configured resources. Other methods will delegate to the first resource only, such as lastModified().

Since:
1.44
Version:
1.0
Author:
matt
  • Constructor Summary

    Constructors
    Constructor
    Description
    ConcatenatingResource(Collection<org.springframework.core.io.Resource> resources)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Get the total length of all configured resources combined.
     
    Get a concatenating input stream of all configured resources combined.
    long
    Get the modification date of the first resource.
     

    Methods inherited from class org.springframework.core.io.AbstractResource

    createRelative, equals, exists, getFile, getFileForLastModifiedCheck, getFilename, getURI, getURL, hashCode, isOpen, isReadable

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.springframework.core.io.Resource

    createRelative, exists, getFile, getFilename, getURI, getURL, isOpen, isReadable
  • Constructor Details

    • ConcatenatingResource

      public ConcatenatingResource(Collection<org.springframework.core.io.Resource> resources)
  • Method Details

    • getInputStream

      public InputStream getInputStream() throws IOException
      Get a concatenating input stream of all configured resources combined.
      Specified by:
      getInputStream in interface org.springframework.core.io.InputStreamSource
      Throws:
      IOException
    • contentLength

      public long contentLength() throws IOException
      Get the total length of all configured resources combined.
      Specified by:
      contentLength in interface org.springframework.core.io.Resource
      Overrides:
      contentLength in class org.springframework.core.io.AbstractResource
      Throws:
      IOException
    • lastModified

      public long lastModified() throws IOException
      Get the modification date of the first resource.
      Specified by:
      lastModified in interface org.springframework.core.io.Resource
      Overrides:
      lastModified in class org.springframework.core.io.AbstractResource
      Throws:
      IOException
    • getDescription

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

      public String toString()
      Overrides:
      toString in class org.springframework.core.io.AbstractResource