| Constructor and Description |
|---|
FileSystemResource(File file)
Constructs a new
FileSystemResource with the specified File. |
FileSystemResource(Path file)
Constructs a new
FileSystemResource with the specified Path. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other) |
boolean |
exists()
Tests whether a resource exists.
|
Path |
getFile()
Gets the file.
|
Optional<String> |
getFileName()
Gets the file name of this resource.
|
InputStream |
getInputStream()
Open an
InputStream for the underlying resource. |
OutputStream |
getOutputStream()
Open an
OutputStream for the underlying resource. |
int |
hashCode() |
boolean |
isReadable()
Tests whether a resource is readable.
|
boolean |
isWritable()
Tests whether a resource is writable.
|
String |
toString() |
URI |
toURI()
Gets a
URI to the underlying resource. |
URL |
toURL()
Gets a
URL to the underlying resource. |
public FileSystemResource(Path file)
FileSystemResource with the specified Path.file - the Pathpublic FileSystemResource(File file)
FileSystemResource with the specified File.file - the Filepublic InputStream getInputStream() throws IOException
ResourceInputStream for the underlying resource.getInputStream in interface ResourceIOException - if resource does not exist or an I/O error occurspublic OutputStream getOutputStream() throws IOException
ResourceOutputStream for the underlying resource.getOutputStream in interface ResourceIOException - if resource does not exist or an I/O error occurspublic URL toURL() throws MalformedURLException
ResourceURL to the underlying resource.toURL in interface ResourceMalformedURLExceptionpublic URI toURI()
ResourceURI to the underlying resource.public Optional<String> getFileName()
ResourcegetFileName in interface Resourcepublic boolean exists()
Resourcepublic boolean isWritable()
ResourceisWritable in interface Resourcetrue if the resource exists and is writablepublic boolean isReadable()
ResourceisReadable in interface Resourcetrue if the resource exists and is readablepublic Path getFile()
Copyright © 2023. All rights reserved.