create a data URI from an URL

Recently I needed for my mapjfx project to convert an image, where I had the URL of, to a base64 encoded data-URI. The following code shows how to do the conversion (Java 8 code): /* * (c) 2015 P.J. Meisch ( */ import; import; import; import; import*; import java.util.Base64; import java.util.logging.Level; import java.util.logging.Logger; public class Test { private static Logger logger = Logger.getAnonymousLogger(); public static URI getDataURIForURL(URL url) { URI dataUri = null; if (null !