code: public String fetchContent(URL url, boolean useProxy) throws DownloadFailedException {
          try (HttpResourceConnection conn = new HttpResourceConnection(settings, useProxy);
                  ByteArrayOutputStream out = new ByteArrayOutputStream()) {
              final InputStream in = conn.fetch(url);
              IOUtils.copy(in, out);
              return out.toString(UTF8);
          } catch (IOException ex) {
              final String msg = format("Download failed, unable to retrieve '%s'", url.toString());
              throw new DownloadFailedException(msg, ex);
          }
      }
docs: Retrieves a file from a given URL and returns the contents.
  
  @param url the URL of the file to download
  @param useProxy whether to use the configured proxy when downloading
  files
  @return the content of the file
  @throws DownloadFailedException is thrown if there is an error
  downloading the file