code: private String readResponseStream(InputStream responseStream, HttpURLConnection connection)
              throws IOException {
          LOGGER.debug("Reading response stream");
          InputStream decodedStream = responseStream;
          if (compression == Compression.LZF && "lzf".equals(connection.getHeaderField("Content-Encoding"))) {
              LOGGER.debug("Decoding lzf");
              decodedStream = new LZFInputStream(responseStream);
          }
  
          int contentLength = connection.getContentLength();
  
          if (contentLength == 0) {
              return "";
          } else {
              return new String(ByteStreams.toByteArray(decodedStream), UTF_8);
          }
      }
docs: Tries to efficiently allocate the response string if the "Content-Length"
  header is set.