code: public void setInputStream(String body) {
          try (
              ByteArrayInputStream stream = new ByteArrayInputStream(body.getBytes(DEFAULT_CHARSET))
          ) {
              cachedInputStream = new ByteArrayOutputStream();
              IOUtils.copy(stream, cachedInputStream);
          } catch (IOException e) {
              LOG.error("Exception on writing InputStream.", e);
          }
      }
docs: Set the cachedInputStream as a copy of UTF-8 encoded {@link ByteArrayInputStream}
  
  @param body {@link String} body to create the {@link ByteArrayInputStream} from