|
The Spring Framework | |||||||||
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
public class UrlResource
Resource
implementation for java.net.URL
locators.
Obviously supports resolution as URL, and also as File in case of
the "file:" protocol.
URL
Constructor Summary | |
---|---|
UrlResource(String path)
Create a new UrlResource. |
|
UrlResource(URL url)
Create a new UrlResource. |
Method Summary | |
---|---|
Resource |
createRelative(String relativePath)
This implementation creates a UrlResource, applying the given path relative to the path of the underlying URL of this resource descriptor. |
boolean |
equals(Object obj)
This implementation compares the underlying URL references. |
String |
getDescription()
This implementation returns a description that includes the URL. |
File |
getFile()
This implementation returns a File reference for the underlying URL, provided that it refers to a file in the file system. |
String |
getFilename()
This implementation returns the name of the file that this URL refers to. |
InputStream |
getInputStream()
This implementation opens an InputStream for the given URL. |
URL |
getURL()
This implementation returns the underlying URL reference. |
int |
hashCode()
This implementation returns the hash code of the underlying URL reference. |
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 |
Constructor Detail |
---|
public UrlResource(URL url)
url
- a URLpublic UrlResource(String path) throws MalformedURLException
path
- a URL path
MalformedURLException
- if the given URL path is not validMethod Detail |
---|
public InputStream getInputStream() throws IOException
false
,
mainly to avoid jar file locking on Windows.
IOException
- if the stream could not be openedURL.openConnection()
,
URLConnection.setUseCaches(boolean)
,
URLConnection.getInputStream()
public URL getURL() throws IOException
getURL
in interface Resource
getURL
in class AbstractResource
IOException
- if the resource cannot be resolved as URL,
i.e. if the resource is not available as descriptorpublic File getFile() throws IOException
getFile
in interface Resource
getFile
in class AbstractResource
IOException
- if the resource cannot be resolved as absolute
file path, i.e. if the resource is not available in a file systemResourceUtils.getFile(java.net.URL, String)
public Resource createRelative(String relativePath) throws MalformedURLException
createRelative
in interface Resource
createRelative
in class AbstractResource
relativePath
- the relative path (relative to this resource)
MalformedURLException
URL.URL(java.net.URL, String)
public String getFilename()
getFilename
in interface Resource
getFilename
in class AbstractResource
URL.getFile()
,
File.getName()
public String getDescription()
Object.toString()
public boolean equals(Object obj)
equals
in class AbstractResource
Resource.getDescription()
public int hashCode()
hashCode
in class AbstractResource
Resource.getDescription()
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |