java - break url into parts
Posted on 2011-04-26
I have a long list of urls (10million). I need to parse each and extract its protocol, domain, path, and query string.
URL u = new URL(URLDecoder.decode(url, "UTF-8")); Isn't viable because many of the URLs are malformed and this throws exceptions.
I'd like methods that would just return null if they can't parse and keep going or any other efficient way of breaking the urls without throwing exceptions.