Class OriginTrackedResource

java.lang.Object
org.springframework.boot.origin.OriginTrackedResource
All Implemented Interfaces:
OriginProvider, org.springframework.core.io.InputStreamSource, org.springframework.core.io.Resource
Direct Known Subclasses:
OriginTrackedResource.OriginTrackedWritableResource

public class OriginTrackedResource extends Object implements org.springframework.core.io.Resource, OriginProvider
Decorator that can be used to add Origin information to a Resource or WritableResource.
Since:
2.4.0
See Also:
  • Method Details

    • 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
    • isFile

      public boolean isFile()
      Specified by:
      isFile 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
    • readableChannel

      public ReadableByteChannel readableChannel() throws IOException
      Specified by:
      readableChannel 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
    • getResource

      public org.springframework.core.io.Resource getResource()
    • getOrigin

      public Origin getOrigin()
      Description copied from interface: OriginProvider
      Return the source origin or null if the origin is not known.
      Specified by:
      getOrigin in interface OriginProvider
      Returns:
      the origin or null
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • of

      public static OriginTrackedResource.OriginTrackedWritableResource of(org.springframework.core.io.WritableResource resource, Origin origin)
      Return a new origin tracked version the given WritableResource.
      Parameters:
      resource - the tracked resource
      origin - the origin of the resource
      Returns:
      an OriginTrackedResource.OriginTrackedWritableResource instance
    • of

      public static OriginTrackedResource of(org.springframework.core.io.Resource resource, Origin origin)
      Return a new origin tracked version the given Resource.
      Parameters:
      resource - the tracked resource
      origin - the origin of the resource
      Returns:
      an OriginTrackedResource instance