public final class URL extends Object implements android.os.Parcelable
Modifier and Type | Field and Description |
---|---|
static android.os.Parcelable.Creator<URL> |
CREATOR |
static URL |
EMPTY |
Constructor and Description |
---|
URL(String value)
Create a URL object with an absolute or relative URL.
|
Modifier and Type | Method and Description |
---|---|
String |
asStringURL()
|
URL |
asURL()
Returns current URL as a
URL . |
int |
describeContents() |
boolean |
equals(Object o) |
String |
getLastTerm()
Returns las part of provided value, separated by '/'.
|
String |
getValue()
Original value provided to de constructor
|
int |
hashCode() |
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.
|
String |
path() |
int |
port()
Gets the port number of this URL.
|
String |
protocol()
Wrap of
this.asURL() and method URL.getProtocol() |
String |
toString() |
void |
writeToParcel(android.os.Parcel dest,
int flags) |
public static final URL EMPTY
public static final android.os.Parcelable.Creator<URL> CREATOR
public String getValue()
public String getLastTerm()
public boolean isAbsolute()
isRelative()
public boolean isRelative()
isAbsolute()
public URL asURL() throws MalformedURLException
URL
. If url is relative, host with port is current URLs#SERVER
URL
MalformedURLException
- exception thrown by URL
when createdpublic String protocol() throws MalformedURLException
this.asURL()
and method URL.getProtocol()
String
MalformedURLException
- exception thrown by URL
when createdpublic String host() throws MalformedURLException
this.asURL()
and method URL.getHost()
String
MalformedURLException
- exception thrown by URL
when createdpublic int port() throws MalformedURLException
URL
has no default port to this protocol, then -1 is returned.MalformedURLException
- exception thrown by URL
when createdpublic String path() throws MalformedURLException
MalformedURLException
public int describeContents()
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel dest, int flags)
writeToParcel
in interface android.os.Parcelable