Package org.elypia.webservertestbed
Class ResourceUtils
- java.lang.Object
-
- org.elypia.webservertestbed.ResourceUtils
-
public final class ResourceUtils extends Object
Utility methods for testing.- Since:
- 1.0.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]getAsBytes(String name)static InputStreamgetAsStream(String name)static StringgetAsString(String name)Load all content from the file specified.
-
-
-
Method Detail
-
getAsStream
public static InputStream getAsStream(String name)
- Parameters:
name- The path to the resource to load.- Returns:
- The InputStream of the resource located at the specified path relative to the root of the classpath.
- Throws:
NullPointerException- If the resource doesn't exist.
-
getAsBytes
public static byte[] getAsBytes(String name) throws IOException
- Throws:
IOException
-
getAsString
public static String getAsString(String name) throws IOException
Load all content from the file specified. Path should be relative to the root of the classpath.- Parameters:
name- The path to the resource to load.- Returns:
- The content of the file.
- Throws:
IOException- If we fail to read the resource.
-
-