Applies this JsonPath to the provided json file

@param jsonFile      file to read from
@param configuration configuration to use
@param <T>           expected return type
@return list of objects matched by the given path
@throws IOException
164778
@SuppressWarnings({"unchecked"})
    public <T> T read(File jsonFile, Configuration configuration) throws IOException {
        notNull(jsonFile, "json file can not be null");
        isTrue(jsonFile.exists(), "json file does not exist");
        notNull(configuration, "jsonProvider can not be null");

        FileInputStream fis = null;
        try {
            fis = new FileInputStream(jsonFile);
            return read(fis, configuration);
        } finally {
            Utils.closeQuietly(fis);
        }
    }
82072
public static <T> T loadConfigurationModel(Class<T> clzz, String configurationFileLocation) {
        System.out.println("Loading config file " + configurationFileLocation);
        InputStream fileContents = null;
        try {
            fileContents = getRequiredResourceAsStream(configurationFileLocation);
            return Jackson.load(clzz, fileContents);
        } catch (IOException e) {
            System.err.println("Failed to read the configuration file " + configurationFileLocation);
            throw new RuntimeException(e);
        } finally {
            if (fileContents != null) {
                Utils.closeQuietly(fileContents);
            }
        }
    }
195735
public JSONObject getJsonConfig(Path name)
      throws IOException, JSONException {
    String pathString = name.toUri().getPath();
    String xml = new Path(pathString).getName();
    File jsonFile = new File(pathString.replace(xml, MATERIALIZEDJSON))
        .getAbsoluteFile();
    if (jsonFile.exists()) {
      InputStream in = new BufferedInputStream(new FileInputStream(jsonFile));
      if (in != null) {
        JSONObject json = instantiateJsonObject(in);
        // Try to load the xml entity inside the json blob.
        if (json.has(xmlToThrift(xml))) {
          return json.getJSONObject(xmlToThrift(xml));
        }
      }
    }
    return null;
  }
42801
public static Map<String, ? extends CacheConfig> fromJSON(URL url) throws IOException {
        return new CacheConfigSupport().fromJSON(url);
    }
315233
public static Map<String, ? extends CacheConfig> fromJSON(InputStream inputStream) throws IOException {
        return new CacheConfigSupport().fromJSON(inputStream);
    }
1290736
public static Map<String, Object> get(File packageFile) throws IOException {
    ZipFile zipFile = null;
    try {
      zipFile = new ZipFile(packageFile);
      ZipArchiveEntry entry = zipFile.getEntry(ZIP_ENTRY_PROPERTIES);
      if (entry != null && !entry.isDirectory()) {
        Map<String, Object> props = getPackageProperties(zipFile, entry);
        return new TreeMap<>(transformPropertyTypes(props));
      }
      return Collections.emptyMap();
    }
    finally {
      IOUtils.closeQuietly(zipFile);
    }
  }
972550
private void findConfigFiles() {
    // Find the materialized_JSON configuration file.
    if (configFileName == null) {
      String jsonConfigFileString = conf.getConfigFile().replace(
                                         CoronaConf.DEFAULT_CONFIG_FILE,
                                         Configuration.MATERIALIZEDJSON);
      File jsonConfigFile = new File(jsonConfigFileString);
      String jsonConfigFileName = null;
      if (jsonConfigFile.exists()) {
        jsonConfigFileName = jsonConfigFileString;
      } else {
          URL u = classLoader.getResource(jsonConfigFileString);
          jsonConfigFileName = (u != null) ? u.getPath() : null;
      }
      // Check that the materialized_JSON contains the resources
      // of corona.xml
      if (jsonConfigFileName != null) {
        try {
          jsonConfigFile = new File(jsonConfigFileName);
          InputStream in = new BufferedInputStream(new FileInputStream(
        		                                           jsonConfigFile));
          JSONObject json = conf.instantiateJsonObject(in);
          if (json.has(conf.xmlToThrift(CoronaConf.DEFAULT_CONFIG_FILE))) {
            configFileName = jsonConfigFileName;
            LOG.info("Attempt to find config file " + jsonConfigFileString +
                     " as a file and in class loader returned " + configFileName);
          }
        } catch (IOException e) {
            LOG.warn("IOException: " + "while parsing corona JSON configuration");
        } catch (JSONException e) {
            LOG.warn("JSONException: " + "while parsing corona JSON configuration");
        }
      }
    }
    if (configFileName == null) {
      // Parsing the JSON configuration failed.  Look for
      // the xml configuration.
      String configFileString = conf.getConfigFile();
      File configFile = new File(configFileString);
      if (configFile.exists()) {
        configFileName = configFileString;
      } else {
        URL u = classLoader.getResource(configFileString);
        configFileName = (u != null) ? u.getPath() : null;
      }
      LOG.info("Attempt to find config file " + configFileString +
          " as a file and in class loader returned " + configFileName);
    }
    if (poolsConfigFileName == null) {
      String poolsConfigFileString = conf.getPoolsConfigFile();
      File poolsConfigFile = new File(poolsConfigFileString);
      if (poolsConfigFile.exists()) {
        poolsConfigFileName = poolsConfigFileString;
      } else {
        URL u = classLoader.getResource(poolsConfigFileString);
        poolsConfigFileName = (u != null) ? u.getPath() : null;
      }
      LOG.info("Attempt to find pools config file " + poolsConfigFileString +
          " as a file and in class loader returned " + poolsConfigFileName);
    }
  }
540997
public static Workspace loadWorkspaceFromJson(File file) throws Exception {
        if (file == null) {
            throw new IllegalArgumentException("The path to a JSON file must be specified.");
        } else if (!file.exists()) {
            throw new IllegalArgumentException("The specified JSON file does not exist.");
        }

        return new JsonReader().read(new FileReader(file));
    }
915772
@Override
	protected void loadConfig(Properties props, String path, InputStream is) {
		try {

			// load properties into a Properties object
			String jsonContent = IOUtils.toString(is);
			// create an ObjectMapper instance.
			ObjectMapper mapper = new ObjectMapper();
			mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES,
					true);

			// use the ObjectMapper to read the json string and create a tree
			JsonNode node = mapper.readTree(jsonContent);
			generateProperties(node, null, props);
		} catch (JsonParseException e) {

			throw new BundlingProcessException(
					"jawr configuration could not be loaded at " + path
							+ FIELD_NAME_SEPARATOR, e);
		} catch (IOException e) {
			throw new BundlingProcessException(
					"jawr configuration could not be loaded at " + path
							+ FIELD_NAME_SEPARATOR, e);
		}
	}
1349998
@GwtIncompatible("Unnecessary")
  private JsonFileSpec createJsonFileFromModule(JSModule module) throws IOException {
    compiler.resetAndIntitializeSourceMap();

    StringBuilder output = new StringBuilder();
    writeModuleOutput(output, module);

    JsonFileSpec jsonFile = new JsonFileSpec(output.toString(),
        getModuleOutputFileName(module));

    StringBuilder moduleSourceMap = new StringBuilder();

    compiler.getSourceMap().appendTo(moduleSourceMap,
        getModuleOutputFileName(module));

    jsonFile.setSourceMap(moduleSourceMap.toString());

    return jsonFile;
  }
1222848
public static <D> File toJsonFile(D dataObject, File returnJsonFile) {
        try {
            jsonMapper.writeValue(returnJsonFile, dataObject);
            return returnJsonFile;
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturnNull(log, e,
                    "toJsonFile", dataObject);
        }
    }
1213123
@GwtIncompatible("Unnecessary")
  JsonFileSpec createJsonFile(B options, String outputMarker, Function<String, String> escaper)
      throws IOException {
    Appendable jsOutput = new StringBuilder();
    writeOutput(
        jsOutput, compiler, (JSModule) null, config.outputWrapper,
        outputMarker, escaper);

    JsonFileSpec jsonOutput = new JsonFileSpec(jsOutput.toString(),
        Strings.isNullOrEmpty(config.jsOutputFile) ?
            "compiled.js" : config.jsOutputFile);

    if (!Strings.isNullOrEmpty(options.sourceMapOutputPath)) {
      StringBuilder sourcemap = new StringBuilder();
      compiler.getSourceMap().appendTo(sourcemap, jsonOutput.getPath());
      jsonOutput.setSourceMap(sourcemap.toString());
    }

    return jsonOutput;
  }
246218
public static DocumentContext parse(File json, Configuration configuration) throws IOException {
        return new ParseContextImpl(configuration).parse(json);
    }
373837
public static StorageConfiguration deserialize(final File pFile) throws TTIOException {
        try {
            FileReader fileReader = new FileReader(new File(pFile, Paths.ConfigBinary.getFile().getName()));
            JsonReader jsonReader = new JsonReader(fileReader);
            jsonReader.beginObject();
            jsonReader.nextName();
            File file = new File(jsonReader.nextString());
            jsonReader.endObject();
            jsonReader.close();
            fileReader.close();
            return new StorageConfiguration(file);
        } catch (IOException ioexc) {
            throw new TTIOException(ioexc);
        }
    }
192424
protected static function readJsonFile(string $jsonFilePath)
    {
        if (!file_exists($jsonFilePath)) {
            throw new Exception(
                'File '.$jsonFilePath.' not found.',
                self::ERR_FILE_NOT_FOUND
            );
        }

        $infos = json_decode(file_get_contents($jsonFilePath));
        if ($infos === null) {
            throw new Exception(
                json_last_error_msg(),
                self::ERR_JSON_PARSE
            );
        }

        return $infos;
    }
902167
private static NetworkConfig fromFile(File configFile, boolean isJson) throws InvalidArgumentException, IOException, NetworkConfigurationException {

        // Sanity check
        if (configFile == null) {
            throw new InvalidArgumentException("configFile must be specified");
        }

        if (logger.isTraceEnabled()) {
            logger.trace(format("NetworkConfig.fromFile: %s  isJson = %b", configFile.getAbsolutePath(), isJson));
        }

        NetworkConfig config;

        // Json file
        try (InputStream stream = new FileInputStream(configFile)) {
            config = isJson ? fromJsonStream(stream) : fromYamlStream(stream);
        }

        return config;
    }
1034485
public static Map<String, ? extends CacheConfig> fromJSON(Reader reader) throws IOException {
        return new CacheConfigSupport().fromJSON(reader);
    }