|
Groovy Documentation | |||||||
| 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.ClassPathResource
public class ClassPathResource extends AbstractFileResolvingResource
Resource implementation for class path resources. Uses either a given ClassLoader or a given Class for loading resources.
Supports resolution as java.io.File if the class path
resource resides in the file system, but not for resources in a JAR.
Always supports resolution as URL.
| Constructor Summary | |
ClassPathResource(java.lang.String path)
Create a new ClassPathResource for ClassLoader usage. |
|
ClassPathResource(java.lang.String path, java.lang.ClassLoader classLoader)
Create a new ClassPathResource for ClassLoader usage. |
|
ClassPathResource(java.lang.String path, java.lang.Class clazz)
Create a new ClassPathResource for Class usage. |
|
protected ClassPathResource(java.lang.String path, java.lang.ClassLoader classLoader, java.lang.Class clazz)
Create a new ClassPathResource with optional ClassLoader and Class. |
|
| Method Summary | |
|---|---|
Resource
|
createRelative(java.lang.String relativePath)
This implementation creates a ClassPathResource, applying the given path relative to the path of the underlying resource of this descriptor. |
boolean
|
equals(java.lang.Object obj)
This implementation compares the underlying class path locations. |
boolean
|
exists()
This implementation checks for the resolution of a resource URL. |
java.lang.ClassLoader
|
getClassLoader()
Return the ClassLoader that this resource will be obtained from. |
java.lang.String
|
getDescription()
This implementation returns a description that includes the class path location. |
java.lang.String
|
getFilename()
This implementation returns the name of the file that this class path resource refers to. |
java.io.InputStream
|
getInputStream()
This implementation opens an InputStream for the given class path resource. |
java.lang.String
|
getPath()
Return the path for this resource (as resource path within the class path). |
java.net.URI
|
getURI()
|
java.net.URL
|
getURL()
This implementation returns a URL for the underlying class path resource. |
int
|
hashCode()
This implementation returns the hash code of the underlying class path location. |
| Methods inherited from class AbstractFileResolvingResource | |
|---|---|
| contentLength, exists, getFile, getFile, getFileForLastModifiedCheck, isReadable, lastModified |
| Methods inherited from class java.lang.Object | |
|---|---|
| java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
| Constructor Detail |
|---|
public ClassPathResource(java.lang.String path)
The thread context class loader will be used for loading the resource.
path - the absolute path within the class path
public ClassPathResource(java.lang.String path, java.lang.ClassLoader classLoader)
path - the absolute path within the classpathclassLoader - the class loader to load the resource with,
or null for the thread context class loader
public ClassPathResource(java.lang.String path, java.lang.Class clazz)
path - relative or absolute path within the class pathclazz - the class to load resources with
protected ClassPathResource(java.lang.String path, java.lang.ClassLoader classLoader, java.lang.Class clazz)
path - relative or absolute path within the classpathclassLoader - the class loader to load the resource with, if anyclazz - the class to load resources with, if any
| Method Detail |
|---|
public Resource createRelative(java.lang.String relativePath)
@java.lang.Override public boolean equals(java.lang.Object obj)
@java.lang.Override public boolean exists()
public final java.lang.ClassLoader getClassLoader()
public java.lang.String getDescription()
public java.lang.String getFilename()
public java.io.InputStream getInputStream()
public final java.lang.String getPath()
public java.net.URI getURI()
public java.net.URL getURL()
@java.lang.Override public int hashCode()
Groovy Documentation