import java.io.IOException;
import java.net.URL;
+import java.nio.charset.Charset;
+
import org.apache.commons.io.IOUtils;
import org.onap.aai.babel.service.data.BabelArtifact;
ArtifactTestUtils.loadResourceAsString(resource));
}
+ /**
+ * Finds the resource with the given name and returns it as an array of bytes.
+ *
+ * @param resourceName
+ * the /-separated path to the resource
+ * @return the requested resource contents as a byte array
+ * @throws IOException
+ * if the resource could not be found (using current privileges)
+ */
public byte[] loadResource(String resourceName) throws IOException {
URL resource = getResource(resourceName);
if (resource != null) {
}
public static String loadResourceAsString(String resourceName) throws IOException {
- return IOUtils.toString(getResource(resourceName));
+ return IOUtils.toString(getResource(resourceName), Charset.defaultCharset());
}
private static URL getResource(String resourceName) {