code: public void writeToStream(final String format, final OutputStream outputStream) {
          try {
              LOGGER.debug("Writing WordCloud image data to output stream");
              ImageIO.write(bufferedImage, format, outputStream);
              LOGGER.debug("Done writing WordCloud image data to output stream");
  
          } catch (final IOException e) {
              LOGGER.error(e.getMessage(), e);
              throw new KumoException("Could not write wordcloud to outputstream due to an IOException", e);
          }
      }
docs: Write wordcloud image data to stream in the given format
  
  @param format       the image format
  @param outputStream the output stream to write image data to