I want to url encode a string that has an unsupported url protocol(scheme). So, on the 3rd line, an exception will be thrown. Is there anyway to make URL class support "mmsh" or any other "custom_name" scheme?
EDIT: I do not want to register some protocols for my application. I just want to be able to use URL class without "unsupported protocol" exception. I am using URL class just to parse and tidy the url string.
String string="mmsh://myserver.com/abc";
String decodedURL = URLDecoder.decode(string, "UTF-8");
URL url = new URL(decodedURL);
URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef());