code: @SuppressWarnings("UnusedDeclaration")
      private String createDataURI(final URL imageURL) {
          return imgCache.computeIfAbsent(imageURL, url -> {
              String dataUrl = null;
              try (final InputStream isGuess = url.openStream();
                   final InputStream isConvert = url.openStream();
                   final ByteArrayOutputStream os = new ByteArrayOutputStream()) {
                  final String contentType = URLConnection.guessContentTypeFromStream(isGuess);
                  if (null != contentType) {
                      final byte[] chunk = new byte[4096];
                      int bytesRead;
                      while ((bytesRead = isConvert.read(chunk)) > 0) {
                          os.write(chunk, 0, bytesRead);
                      }
                      os.flush();
                      dataUrl = "data:" + contentType + ";base64," + Base64.getEncoder().encodeToString(os
                              .toByteArray());
                  } else {
                      if (logger.isWarnEnabled()) {
                          logger.warn("could not get content type from {}", imageURL.toExternalForm());
                      }
                  }
              } catch (final IOException e) {
                  if (logger.isWarnEnabled()) {
                      logger.warn("error loading image", e);
                  }
              }
              if (null == dataUrl) {
                  if (logger.isWarnEnabled()) {
                      logger.warn("could not create data url from {}", imageURL.toExternalForm());
                  }
              }
              return dataUrl;
          });
      }
docs: loads an image and converts it's data to a base64 encoded data url.
  
  NOT NEEDED AT THE MOMENT
  
  @param imageURL
  where to load the image from, may not be null
  @return the encoded image as data url