| 构造器和说明 |
|---|
UrlResource(String url) |
UrlResource(URI uri) |
UrlResource(URL url) |
| 限定符和类型 | 方法和说明 |
|---|---|
long |
contentLength()
Determine the content length for this resource.
|
boolean |
equals(Object obj) |
boolean |
exists()
Determine whether this resource actually exists in physical form.
|
String |
getAbsolutePath() |
InputStream |
getInputStream()
Return an
InputStream for the content of an underlying resource. |
URL |
getRealResource() |
URL |
getUrl() |
int |
hashCode() |
getLocation, getPath, getPrefix, setLocation, setLocation, toStringisReadable, readableChannelpublic UrlResource(String url)
public UrlResource(URI uri)
public UrlResource(URL url)
public InputStream getInputStream() throws IOException
ResourceInputStream for the content of an underlying resource.
It is expected that each call creates a fresh stream.
This requirement is particularly important when you consider an API such
as JavaMail, which needs to be able to read the stream multiple times when
creating mail attachments. For such a use case, it is required
that each getInputStream() call returns a fresh stream.
null)FileNotFoundException - if the underlying resource doesn't existIOException - if the content stream could not be openedpublic boolean exists()
ResourceThis method performs a definitive existence check, whereas the
existence of a Resource handle only guarantees a valid
descriptor handle.
public String getAbsolutePath()
public URL getRealResource()
public long contentLength()
Resourcepublic URL getUrl()
Copyright © 2020. All rights reserved.