code: private String readResourceAsString(Resource resource) throws IOException {
  
          StringBuilder contents = new StringBuilder();
  
          // Read entire resource into StringBuilder one chunk at a time
          Reader reader = new InputStreamReader(resource.asStream(), "UTF-8");
          try {
  
              char buffer[] = new char[8192];
              int length;
  
              while ((length = reader.read(buffer)) != -1) {
                  contents.append(buffer, 0, length);
              }
  
          }
  
          // Ensure resource is always closed
          finally {
              reader.close();
          }
  
          return contents.toString();
  
      }
docs: Reads the entire contents of the given resource as a String. The
  resource is assumed to be encoded in UTF-8.
  
  @param resource
  The resource to read as a new String.
  
  @return
  A new String containing the contents of the given resource.
  
  @throws IOException
  If an I/O error prevents reading the resource.