open class PathResource : AbstractResource, WritableResource
Resource implementation for java.nio.file.Path handles. Supports resolution as File, and also as URL. Implements the extended WritableResource interface.
Author
Philippe Marschall
Author
Juergen Hoeller
Since
4.0
See Also
FileSystemResourcejava.nio.file.Pathjava.nio.file.Files
PathResource(path: Path)PathResource(path: String)PathResource(uri: URI)
Create a new PathResource from a Path handle. Note: Unlike FileSystemResource, when building relative resources via |
open fun contentLength(): Long
This implementation returns the underlying File's length. |
|
open fun createRelative(relativePath: String): Resource
This implementation creates a PathResource, applying the given path relative to the path of the underlying file of this resource descriptor. |
|
open fun equals(other: Any?): Boolean
This implementation compares the underlying Path references. |
|
open fun exists(): Boolean
This implementation returns whether the underlying file exists. |
|
open fun getDescription(): String |
|
open fun getFile(): File
This implementation returns the underlying File reference. |
|
open fun getFilename(): String
This implementation returns the name of the file. |
|
open fun getInputStream(): InputStream
This implementation opens a InputStream for the underlying file. |
|
open fun getOutputStream(): OutputStream
This implementation opens a OutputStream for the underlying file. |
|
fun getPath(): String
Return the file path for this resource. |
|
open fun getURI(): URI
This implementation returns a URI for the underlying file. |
|
open fun getURL(): URL
This implementation returns a URL for the underlying file. |
|
open fun hashCode(): Int
This implementation returns the hash code of the underlying Path reference. |
|
open fun isFile(): Boolean
This implementation always indicates a file. |
|
open fun isReadable(): Boolean
This implementation checks whether the underlying file is marked as readable (and corresponds to an actual file with content, not to a directory). |
|
open fun isWritable(): Boolean
This implementation checks whether the underlying file is marked as writable (and corresponds to an actual file with content, not to a directory). |
|
open fun lastModified(): Long
This implementation returns the underlying File's timestamp. |
|
open fun readableChannel(): ReadableByteChannel
This implementation opens a Channel for the underlying file. |
|
open fun writableChannel(): WritableByteChannel
This implementation opens a Channel for the underlying file. |