|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.core.io.AbstractResource org.springframework.core.io.UrlResource
Resource implementation for java.net.URL locators. Obviously supports resolution as URL, and also as File in case of the "file:" protocol.
URL
Field Summary | |
static java.lang.String |
PROTOCOL_FILE
|
Fields inherited from class org.springframework.core.io.AbstractResource |
URL_PROTOCOL_FILE |
Constructor Summary | |
UrlResource(java.lang.String path)
Create a new UrlResource. |
|
UrlResource(java.net.URL url)
Create a new UrlResource. |
Method Summary | |
Resource |
createRelative(java.lang.String relativePath)
This implementation throws a FileNotFoundException, assuming that relative resources cannot be created for this resource. |
boolean |
equals(java.lang.Object obj)
This implementation compares description strings. |
java.lang.String |
getDescription()
Return a description for this resource, to be used for error output when working with the resource. |
java.io.File |
getFile()
This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to an absolute file path. |
java.lang.String |
getFilename()
This implementation always throws IllegalStateException, assuming that the resource does not carry a filename. |
java.io.InputStream |
getInputStream()
Return an InputStream. |
java.net.URL |
getURL()
This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to a URL. |
int |
hashCode()
This implementation returns the description's hash code. |
Methods inherited from class org.springframework.core.io.AbstractResource |
exists, isOpen, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String PROTOCOL_FILE
Constructor Detail |
public UrlResource(java.net.URL url)
url
- a URLpublic UrlResource(java.lang.String path) throws java.net.MalformedURLException
path
- a URL pathMethod Detail |
public java.io.InputStream getInputStream() throws java.io.IOException
InputStreamSource
java.io.IOException
- if the stream could not be openedpublic java.net.URL getURL() throws java.io.IOException
AbstractResource
getURL
in interface Resource
getURL
in class AbstractResource
java.io.IOException
public java.io.File getFile() throws java.io.IOException
AbstractResource
getFile
in interface Resource
getFile
in class AbstractResource
java.io.IOException
public Resource createRelative(java.lang.String relativePath) throws java.net.MalformedURLException
AbstractResource
createRelative
in interface Resource
createRelative
in class AbstractResource
java.net.MalformedURLException
public java.lang.String getFilename()
AbstractResource
getFilename
in interface Resource
getFilename
in class AbstractResource
public java.lang.String getDescription()
Resource
Implementations are also encouraged to return this value from their toString method.
Object.toString()
public boolean equals(java.lang.Object obj)
AbstractResource
equals
in class AbstractResource
Resource.getDescription()
public int hashCode()
AbstractResource
hashCode
in class AbstractResource
Resource.getDescription()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |