Class PathResource

    • Constructor Summary

      Constructors 
      ConstructorDescription
      PathResource​(String path)
      Create a new PathResource from a Path handle.
      PathResource​(URI uri)
      Create a new PathResource from a Path handle.
      PathResource​(Path path)
      Create a new PathResource from a Path handle.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      longcontentLength()
      This implementation returns the underlying file's length.
      ResourcecreateRelative​(String relativePath)
      This implementation creates a PathResource, applying the given path relative to the path of the underlying file of this resource descriptor.
      booleanequals​(Object obj)
      This implementation compares the underlying Path references.
      booleanexists()
      This implementation returns whether the underlying file exists.
      StringgetDescription()
      Return a description for this resource, to be used for error output when working with the resource.
      FilegetFile()
      This implementation returns the underlying File reference.
      StringgetFilename()
      This implementation returns the name of the file.
      InputStreamgetInputStream()
      This implementation opens a InputStream for the underlying file.
      OutputStreamgetOutputStream()
      This implementation opens a OutputStream for the underlying file.
      StringgetPath()
      Return the file path for this resource.
      URIgetURI()
      This implementation returns a URI for the underlying file.
      URLgetURL()
      This implementation returns a URL for the underlying file.
      inthashCode()
      This implementation returns the hash code of the underlying Path reference.
      booleanisReadable()
      This implementation checks whether the underlying file is marked as readable (and corresponds to an actual file with content, not to a directory).
      booleanisWritable()
      This implementation checks whether the underlying file is marked as writable (and corresponds to an actual file with content, not to a directory).
      longlastModified()
      This implementation returns the underlying File's timestamp.
      • Methods inherited from interface org.springframework.core.io.Resource

        isOpen