|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.easetech.easytest.io.ClasspathResource
public class ClasspathResource
An instance of Resource interface for handling Classpath resources. The classpath resources is responsible
for loading the resource from the user's classpath.The resource path is specified using the DataLoader's
filePaths attribute and can be prefixed with ResourceLoader.CLASSPATH_PREFIX in order for the
ResourceLoaderStrategy to pick them up. For eg. This class is automatically instantiated by the EasyTest's
ResourceLoaderStrategy when it sees the DataLoader annotation with the filePath attribute being
specified as:
| Constructor Summary | |
|---|---|
ClasspathResource(String path)
Construct a new ClasspathResource and defaults the classLoader with current Threads ContextClassLoader |
|
ClasspathResource(String path,
Class<?> classObj)
Construct a new ClasspathResource instance such that the resource will be loaded using the given Class object. |
|
ClasspathResource(String path,
ClassLoader classLoader)
Construct a new ClasspathResource instance such that the resource will be loaded using the given ClassLoader |
|
ClasspathResource(String path,
ClassLoader classLoader,
Class<?> classObj)
|
|
| Method Summary | |
|---|---|
boolean |
exists()
Identifies whether the resource exists or not. |
ClassLoader |
getClassLoader()
|
Class<?> |
getClassObj()
|
File |
getFile()
Get the File associated with the given file path. |
InputStream |
getInputStream()
Get the input stream associated with the given file path. |
OutputStream |
getOutputStream()
Get the output Stream associated with the given resource. |
String |
getPath()
|
String |
getResourceName()
Get the resource Name associated with the given resource. |
URL |
getURL()
Get the url associated with the given file path. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ClasspathResource(String path)
classLoader with current Threads ContextClassLoader
path - The path of the classpath resourceThread#currentThread()}'s getContextClassLoader method.
public ClasspathResource(String path,
ClassLoader classLoader)
path - the path of the classpath resourceclassLoader - The ClassLoader to load the class path resource
public ClasspathResource(String path,
Class<?> classObj)
path - the path of the classpath resourceclassObj - The Class to load the class path resource
public ClasspathResource(String path,
ClassLoader classLoader,
Class<?> classObj)
| Method Detail |
|---|
public ClassLoader getClassLoader()
public String getPath()
public Class<?> getClassObj()
public boolean exists()
exists in interface Resourcepublic InputStream getInputStream()
getInputStream in interface Resourcepublic URL getURL()
getURL in interface Resourcepublic File getFile()
getFile in interface Resourcepublic String getResourceName()
getResourceName in interface Resourcepublic OutputStream getOutputStream()
getOutputStream in interface Resourcepublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||