Urls { public static String asDataUrlBase64(String data) { return asDataUrlBase64(MediaType.PLAIN_TEXT_UTF_8, data.getBytes()); }  static Function<String,URI> stringToUriFunction(); static Function<String,URL> stringToUrlFunction(); static final URL toUrl(@Nullable String url); static final URL toUrl(@Nullable URI uri); static final URI toUri(@Nullable String uri); static final URI toUri(@Nullable URL url); static boolean isUrlWithProtocol(String x); static boolean isUrlWithProtocol(String x, boolean allowSpacesAfterCharAfterColon, boolean allowMultiline); static String mergePaths(String ...items); static String encode(String text); static String decode(String text); static String getProtocol(String url); static String getBasename(String url); static boolean isDirectory(String fileUrl); static File toFile(String fileUrl); static String asDataUrlBase64(String data); static String asDataUrlBase64(MediaType type, byte[] bytes);  }
@Test public void testDataUrl() throws Exception { String input = "hello world"; String url = Urls.asDataUrlBase64(input); Assert.assertEquals(url, "data:text/plain;base64,aGVsbG8gd29ybGQ="); }