public final class URL
extends java.lang.Object
| Constructor and Description |
|---|
URL(java.lang.String value)
Create a URL object with an absolute or relative URL.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
asStringURL()
|
java.net.URL |
asURL()
Returns current URL as a
URL. |
int |
describeContents() |
boolean |
equals(java.lang.Object o) |
java.lang.String |
getLastTerm()
Returns las part of provided value, separated by '/'.
|
java.lang.String |
getValue()
Original value provided to de constructor
|
int |
hashCode() |
java.lang.String |
host()
Wrap of
this.asURL() and method URL.getHost() |
boolean |
isAbsolute()
Return true if the value used to construct the URL doesn't start by '/', meaning it has a specific host.
|
boolean |
isRelative()
Return true if the value used to construct the URL starts by '/', meaning it has no specific host nor port.
|
java.lang.String |
path() |
int |
port()
Gets the port number of this URL.
|
java.lang.String |
protocol()
Wrap of
this.asURL() and method URL.getProtocol() |
java.lang.String |
toString() |
void |
writeToParcel(Parcel dest,
int flags) |
public static final URL EMPTY
public static final <any> CREATOR
public URL(java.lang.String value)
URLs#SERVER as host with port.value - Stringpublic java.lang.String getValue()
public java.lang.String getLastTerm()
public boolean isAbsolute()
isRelative()public boolean isRelative()
isAbsolute()public java.net.URL asURL()
throws java.net.MalformedURLException
URL. If url is relative, host with port is current URLs#SERVERURLjava.net.MalformedURLException - exception thrown by URL when createdpublic java.lang.String asStringURL()
Stringpublic java.lang.String protocol()
throws java.net.MalformedURLException
this.asURL() and method URL.getProtocol()Stringjava.net.MalformedURLException - exception thrown by URL when createdpublic java.lang.String host()
throws java.net.MalformedURLException
this.asURL() and method URL.getHost()Stringjava.net.MalformedURLException - exception thrown by URL when createdpublic int port()
throws java.net.MalformedURLException
URL has no default port to this protocol, then -1 is returned.java.net.MalformedURLException - exception thrown by URL when createdpublic java.lang.String path()
throws java.net.MalformedURLException
java.net.MalformedURLExceptionpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic int describeContents()
public void writeToParcel(Parcel dest,
int flags)