public final class URLs extends Object
| Modifier and Type | Method and Description |
|---|---|
static URL |
create(String url)
Creates a new
URL by parsing the given String. |
static String |
relativize(URL base,
URL full)
Relativizes the specified full
URL against the given base. |
static URL |
resolve(URL base,
String path)
Resolves the specified path against the given base
URL. |
public static URL create(String url)
URL by parsing the given String. This
function invokes the URL.URL(java.lang.String) constructor;
any MalformedURLException thrown by the constructor is caught
and wrapped in a new IllegalArgumentException, which is then
thrown. This method is provided for use in situations where it is
known that the given String is a legal URL.url - the String to be parsed into a URL.URL.NullPointerException - if url is null.IllegalArgumentException - if url is not a valid URL.public static String relativize(URL base, URL full)
URL against the given base.
Behaves as URI.relativize(java.net.URI).base - the base URL.full - the full URL.NullPointerException - if one of the arguments is null.IllegalArgumentException - if the relativization fails.public static URL resolve(URL base, String path)
URL.
Behaves as URI.resolve(java.lang.String).base - the base URL.path - the path to resolve.URL.NullPointerException - if one of the arguments is null.IllegalArgumentException - if the path can't be resolved.Copyright © 2012–2015. All rights reserved.