public interface Resource
ClassPathResource,
FileSystemResource,
UrlResource| Modifier and Type | Method and Description |
|---|---|
boolean |
exists()
Tests whether a resource exists.
|
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. |
boolean |
isReadable()
Tests whether a resource is readable.
|
boolean |
isWritable()
Tests whether a resource is writable.
|
default URI |
toURI()
Gets a
URI to the underlying resource. |
URL |
toURL()
Gets a
URL to the underlying resource. |
Optional<String> getFileName()
boolean exists()
true if the resource existsboolean isWritable()
true if the resource exists and is writableboolean isReadable()
true if the resource exists and is readableInputStream getInputStream() throws IOException
InputStream for the underlying resource.IOException - if resource does not exist or an I/O error occursOutputStream getOutputStream() throws IOException
OutputStream for the underlying resource.IOException - if resource does not exist or an I/O error occursURL toURL() throws IOException
URL to the underlying resource.IOException - if resource does not exist, or URL cannot be builtdefault URI toURI() throws IOException
URI to the underlying resource.IOException - if resource does not exist, or URI cannot be builtCopyright © 2023. All rights reserved.