docs: public static String inputStreamToString(InputStream inputStream, Charset charset) throws IOException {
          if (inputStream != null && inputStream.available() != -1) {
              ByteArrayOutputStream result = new ByteArrayOutputStream();
              byte[] buffer = new byte[1024];
              int length;
              while ((length = inputStream.read(buffer)) != -1) {
                  result.write(buffer, 0, length);
              }
              if (charset != null) {
                  return result.toString(charset.name());
              }
              return result.toString(StandardCharsets.UTF_8.name());
          }
          return null;
      }