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
- String
public 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#SERVER
URL
java.net.MalformedURLException
- exception thrown by URL
when createdpublic java.lang.String asStringURL()
String
public java.lang.String protocol() throws java.net.MalformedURLException
this.asURL()
and method URL.getProtocol()
String
java.net.MalformedURLException
- exception thrown by URL
when createdpublic java.lang.String host() throws java.net.MalformedURLException
this.asURL()
and method URL.getHost()
String
java.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.MalformedURLException
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int describeContents()
public void writeToParcel(Parcel dest, int flags)