Class ResourceFileUtils

java.lang.Object
com.eqixiac.equinix.core.util.ResourceFileUtils

public final class ResourceFileUtils extends Object
Author:
ianjones
  • 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 an InputStream so 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 a jar:file:...!/... entry that cannot be turned into a Path).
      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 bootstrap
      IOException - if the resource exists but cannot be read or parsed