|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.codehaus.groovy.grails.io.support.AbstractFileResolvingResource
org.codehaus.groovy.grails.io.support.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(java.lang.String path)
Create a new UrlResource. |
|
UrlResource(java.net.URI uri)
Create a new UrlResource. |
|
UrlResource(java.net.URL url)
Create a new UrlResource. |
|
| Method Summary | |
|---|---|
Resource |
createRelative(java.lang.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(java.lang.Object obj)
This implementation compares the underlying URL references. |
java.lang.String |
getDescription()
This implementation returns a description that includes the URL. |
java.io.File |
getFile()
This implementation returns a File reference for the underlying URL/URI, provided that it refers to a file in the file system. |
java.lang.String |
getFilename()
This implementation returns the name of the file that this URL refers to. |
java.io.InputStream |
getInputStream()
This implementation opens an InputStream for the given URL. |
java.net.URI |
getURI()
This implementation returns the underlying URI directly, if possible. |
java.net.URL |
getURL()
This implementation returns the underlying URL reference. |
int |
hashCode()
This implementation returns the hash code of the underlying URL reference. |
java.lang.String |
toString()
|
| Methods inherited from class org.codehaus.groovy.grails.io.support.AbstractFileResolvingResource |
|---|
contentLength, exists, getFile, getFileForLastModifiedCheck, isReadable, lastModified |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public UrlResource(java.net.URL url)
url - a URL
public UrlResource(java.net.URI uri)
throws java.net.MalformedURLException
uri - a URI
java.net.MalformedURLException - if the given URL path is not valid
public UrlResource(java.lang.String path)
throws java.net.MalformedURLException
path - a URL path
java.net.MalformedURLException - if the given URL path is not valid| Method Detail |
|---|
public java.io.InputStream getInputStream()
throws java.io.IOException
false,
mainly to avoid jar file locking on Windows.
java.io.IOExceptionURL.openConnection(),
URLConnection.setUseCaches(boolean),
URLConnection.getInputStream()
public java.net.URL getURL()
throws java.io.IOException
java.io.IOException - if the resource cannot be resolved as URL,
i.e. if the resource is not available as descriptor
public java.net.URI getURI()
throws java.io.IOException
java.io.IOException - if the resource cannot be resolved as URI,
i.e. if the resource is not available as descriptor
public java.io.File getFile()
throws java.io.IOException
getFile in interface ResourcegetFile in class AbstractFileResolvingResourcejava.io.IOException - if the resource cannot be resolved as absolute
file path, i.e. if the resource is not available in a file systempublic Resource createRelative(java.lang.String relativePath)
relativePath - The relative path
URL.URL(java.net.URL, String)public java.lang.String getFilename()
URL.getFile(),
File.getName()public java.lang.String getDescription()
Object.toString()public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||