Class ResourceFileUtils
java.lang.Object
com.eqixiac.equinix.core.util.ResourceFileUtils
- Author:
- ianjones
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.fasterxml.jackson.databind.JsonNodeloadResourceFileJson(String fileName) Loads a classpath resource as JSON.
-
Constructor Details
-
ResourceFileUtils
public ResourceFileUtils()
-
-
Method Details
-
loadResourceFileJson
public static com.fasterxml.jackson.databind.JsonNode loadResourceFileJson(String fileName) throws IOException Loads a classpath resource as JSON. The resource is read through anInputStreamso it resolves correctly whether it is a loose file on disk (e.g. running from an IDE) or packed inside a jar (where the URL is ajar:file:...!/...entry that cannot be turned into aPath).- Parameters:
fileName- the classpath-relative resource name (e.g."json/apiParams_Core.json")- Returns:
- the parsed JSON tree; never
null - Throws:
FileNotFoundException- if no such resource exists on the classpath - a missing resource fails fast with the resource name rather than surfacing later as an opaque NPE during client bootstrapIOException- if the resource exists but cannot be read or parsed
-