|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.smartics.util.test.io.IoTestUtils
public final class IoTestUtils
Utilities to make unit tests with streams to resources from the class path easier.
Method Summary | |
---|---|
static InputStream |
openStreamFromResource(Class<?> type, String relativeResourceName) Returns the specified file from a resource relative to the given type. |
static InputStream |
openStreamFromResource(ClassLoader classLoader, String resourceName) Returns a stream to a resource on the class path. |
static InputStream |
openStreamFromResource(String resourceName) Returns a stream to a resource on the class path loaded by the class loader of this class. |
static InputStream |
openStreamFromResourceByTypeClassLoader(Class<?> type, String resourceName) Returns a stream to a resource on the class path loaded by the class loader that has loaded the given type . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static InputStream openStreamFromResource(String resourceName) throws IllegalArgumentException
resourceName
- name of the resource on the class path.
IllegalArgumentException
- if
resourceName
cannot be found.
public static InputStream openStreamFromResourceByTypeClassLoader(Class<?> type, String resourceName) throws IllegalArgumentException
type
.
type
- the type to refer to the class loader to load the resource from. The resource is relative to this type.
resourceName
- name of the resource on the class path.
IllegalArgumentException
- if
resourceName
cannot be found.
public static InputStream openStreamFromResource(ClassLoader classLoader, String resourceName) throws IllegalArgumentException
classLoader
- the class loader to load the resource from.
resourceName
- name of the resource on the class path.
IllegalArgumentException
- if
resourceName
cannot be found.
public static InputStream openStreamFromResource(Class<?> type, String relativeResourceName) throws IllegalArgumentException
type
- the type to refer to the class loader to load the resource from. The resource is relative to this type.
relativeResourceName
- name of the resource on the class path, relative to the passed in
type
.
IllegalArgumentException
- if
relativeResourceName
cannot be found.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |