org.linkedin.util-core/src/main/java/org/linkedin/util/url/URLBuilder.java
public static URLBuilder createFromURL(URL url)
  {
    if(url == null)
      return null;
    
    // fast implementation
    if(url instanceof URLBuilder)
    {
      URLBuilder urlBuilder = (URLBuilder) url;
      return urlBuilder.deepClone();
    }

    try
    {
      return createFromURL(url.getURL());
    }
    catch(URISyntaxException e)
    {
      throw new RuntimeException("bad url!" + url.getURL());
    }
  }
public static URLBuilder createFromURL(URL url)
  {
    if(url == null)
      return null;
    
    // fast implementation
    if(url instanceof URLBuilder)
    {
      URLBuilder urlBuilder = (URLBuilder) url;
      return urlBuilder.deepClone();
    }

    try
    {
      return createFromURL(url.getURL());
    }
    catch(URISyntaxException e)
    {
      throw new RuntimeException("bad url!" + url.getURL());
    }
  }
Factory method from a url

@param url the url
@return the builder