|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.core.io.ClassPathResource
public class ClassPathResource
These classes are all extracted from the Spring Framework in order to remove the dependency on the Spring library.
| Constructor Summary | |
|---|---|
|
ClassPathResource(java.lang.String path)
Create a new ClassPathResource for ClassLoader usage.
|
|
ClassPathResource(java.lang.String path,
java.lang.Class clazz)
Create a new ClassPathResource for Class usage.
|
|
ClassPathResource(java.lang.String path,
java.lang.ClassLoader classLoader)
Create a new ClassPathResource for ClassLoader 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 | |
|---|---|
boolean |
equals(java.lang.Object object)
This implementation compares the underlying class path locations. |
boolean |
exists()
This implementation checks whether a File can be opened, falling back to whether an InputStream can be opened. |
java.io.File |
getFile()
This implementation returns a File reference for the underlying class path resource, provided that it refers to a file in the file system. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll,
toString, wait, wait, wait |
| Constructor Detail |
|---|
public ClassPathResource(java.lang.String path)
Create a new ClassPathResource for ClassLoader usage. A
leading slash will be removed, as the ClassLoader resource access
methods
will not accept it. The thread context class loader will be used for
loading the resource.
path - the absolute path within the class path
ClassLoader.getResourceAsStream(String)
public ClassPathResource(java.lang.String path,
java.lang.ClassLoader classLoader)
Create a new ClassPathResource for ClassLoader usage. A
leading slash will be removed, as the ClassLoader resource access
methods
will not accept it.
path - the absolute path within the classpath
classLoader - the class loader to load the resource
with, or
null for the thread context class loader
ClassLoader.getResourceAsStream(String)
public ClassPathResource(java.lang.String path,
java.lang.Class clazz)
Create a new ClassPathResource for Class usage. The path
can be relative to the given class, or absolute within the classpath via
a leading slash.
path - relative or absolute path within the class
path
clazz - the class to load resources with
Class.getResourceAsStream(java.lang.String)
protected ClassPathResource(java.lang.String path,
java.lang.ClassLoader classLoader,
java.lang.Class clazz)
Create a new ClassPathResource with optional ClassLoader
and Class. Only for internal usage.
path - relative or absolute path within the
classpath
classLoader - the class loader to load the resource
with, if any
clazz - the class to load resources with, if any
| Method Detail |
|---|
public java.io.File getFile()
throws java.io.IOException
This implementation returns a File reference for the underlying class path resource, provided that it refers to a file in the file system.
java.io.IOException - when file not found
public boolean equals(java.lang.Object object)
This implementation compares the underlying class path locations.
equals in class java.lang.Object
public boolean exists()
This implementation checks whether a File can be opened, falling back to whether an InputStream can be opened. This will cover both directories and content resources.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||