| Constructor and Description |
|---|
UrlResource(URL url)
Constructs a new
UrlResource with the specified URL. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other) |
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. |
int |
hashCode() |
boolean |
isReadable()
Tests whether a resource is readable.
|
boolean |
isWritable()
Tests whether a resource is writable.
|
String |
toString() |
URL |
toURL()
Gets a
URL to the underlying resource. |
public UrlResource(URL url)
UrlResource with the specified URL.url - the URLpublic 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 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()
ResourceURL to the underlying resource.Copyright © 2023. All rights reserved.