code: public static String readStreamAsString(InputStream stream, String encoding) throws IOException {
          StringBuilder result = new StringBuilder();
  
          try (Reader reader = readStreamWithReader(stream, encoding)) {
  
              char[] buffer = new char[2048];
              int read;
              while ((read = reader.read(buffer)) > -1) {
                  result.append(buffer, 0, read);
              }
              return result.toString();
          }
      }
docs: Returns the given stream as a string using the given encoding.
  If encoding is null, use {@link Scope#getFileEncoding()}