URLUtil { public static String getDataEncoding(String url){ final int commaPos = url.indexOf(','); final String header = url.substring(0, commaPos); return getEncoding(header); }  static byte[] getData(String url, String encoding); static String getDataEncoding(String url); static boolean isURL(String message); static String getURL(String message); static final String URL_START; static final String URL_END; }
@Test public void testGetDataEncoding() throws Exception { String encoding; encoding = URLUtil.getDataEncoding("data:;base64,flRlc3R+"); assertNull(encoding); encoding = URLUtil.getDataEncoding("data:;charset=ISO-8859-1;base64,flRlc3R+"); assertEquals("ISO-8859-1", encoding); }