Java URL from newURL(CharSequence urlString)

Here you can find the source of newURL(CharSequence urlString)

Description

new URL

License

Open Source License

Declaration

public static URL newURL(CharSequence urlString) 

Method Source Code

//package com.java2s;
/*/* w w w.j av a2  s . c o  m*/
 * SafeOnline project.
 *
 * Copyright 2006-2009 Lin.k N.V. All rights reserved.
 * Lin.k N.V. proprietary/confidential. Use is subject to license terms.
 */

import java.net.MalformedURLException;
import java.net.URL;

public class Main {
    public static URL newURL(CharSequence urlString) {

        return newURL((URL) null, urlString);
    }

    public static URL newURL(URL baseURL, CharSequence relativeURLString) {

        try {
            return relativeURLString == null ? baseURL : new URL(baseURL, relativeURLString.toString());
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }
    }

    public static URL newURL(CharSequence baseURL, CharSequence relativeURLString) {

        return newURL(newURL(baseURL), relativeURLString.toString());
    }
}

Related

  1. makeUrl(String url)
  2. makeUrl(String url)
  3. makeURL(String url)
  4. makeURL(String urlstr)
  5. makeURL(String[] URLStrings)
  6. newUrl(String href)
  7. newURL(String location)
  8. newURL(String url)
  9. newURL(String url_name)