UriUtils { public static String encodeURIComponent(String url) { int schemeTail = url.indexOf(": int pathStart = 0; if (schemeTail > 0) pathStart = url.indexOf('/', schemeTail + 3); else pathStart = url.indexOf('/'); if (pathStart > 0) { String[] tokens = url.substring(pathStart + 1).split("/"); StringBuilder sb = new StringBuilder(url.substring(0, pathStart)); for (String token : tokens) { sb.append("/").append(URLEncoder.encode(token)); } return sb.toString(); } return url; }  static String formNfsUri(String host, String path); static String formIscsiUri(String host, String iqn, Integer lun); static String formFileUri(String path); static String encodeURIComponent(String url); static String getCifsUriParametersProblems(URI uri); static boolean hostAndPathPresent(URI uri); static boolean cifsCredentialsPresent(URI uri); static String getUpdateUri(String url, boolean encrypt); static Long getRemoteSize(String url); static Pair<String, Integer> validateUrl(String url); static Pair<String, Integer> validateUrl(String format, String url); static void checkUrlExistence(String url); static InputStream getInputStreamFromUrl(String url, String user, String password); static final Logger s_logger; }
@Test public void encodeURIComponent() { Assert.assertEquals("http: UriUtils.encodeURIComponent("http: Assert.assertEquals("http: UriUtils.encodeURIComponent("http: Assert.assertEquals("http: UriUtils.encodeURIComponent("http: }