examples/iot-nirvana/common/src/main/java/com/google/cloud/demo/iot/nirvana/common/TemperatureUtils.java
/** Load the list of cities in JSON format from the configuration file */
Load the list of cities in JSON format from the configuration file
Load the list of cities in JSON format from the configuration file
static String loadJsonFromFile() throws FormatException {
    String jsonContent;
    try {
      URL resource = Resources.getResource(CITIES_FILE_PATH);
      jsonContent = Resources.toString(resource, StandardCharsets.UTF_8);
    } catch (IOException e) {
      String message = String.format(READ_FILE_ERR, CITIES_FILE_PATH, e.getMessage());
      throw new FormatException(message, e);
    }
    return jsonContent;
  }
static String loadJsonFromFile ( ) throws FormatException { String jsonContent ; try { URL resource = Resources . getResource ( CITIES_FILE_PATH ) ; jsonContent = Resources . toString ( resource , StandardCharsets . UTF_8 ) ; } catch ( IOException e ) { String message = String . format ( READ_FILE_ERR , CITIES_FILE_PATH , e . getMessage ( ) ) ; throw new FormatException ( message , e ) ; } return jsonContent ; }
Load the list of cities in JSON format from the configuration file
Load the list of cities in JSON format from the configuration file