Url

class Url : Uri

Types

Link copied to clipboard
class Builder(uriBuilder: Uri.Builder = Uri.Builder()) : UrlBuilder, Builder

Helper class for building or manipulating URL references. Not safe for concurrent use.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val authority: String

Gets the decoded authority part of this URL. For server addresses, the authority is structured as follows: [ userinfo '@' ] host [ ':' port ]

Link copied to clipboard
open override val encodedAuthority: String

Gets the encoded authority part of this URL. For server addresses, the authority is structured as follows: {@code userinfo '@' host ':' port }

Link copied to clipboard
open override val encodedFragment: String?

Gets the encoded fragment part of this URI, everything after the '#'.

Link copied to clipboard
open override val encodedPath: String?

Gets the encoded path.

Link copied to clipboard
open override val encodedQuery: String?

Gets the encoded query component from this URI. The query comes after the query separator ('?') and before the fragment separator ('#'). This method would return "q=android" for "http://www.google.com/search?q=android".

Link copied to clipboard

Gets the scheme-specific part of this URI, i.e. everything between the scheme separator ':' and the fragment separator '#'. Leaves escaped octets intact.

Link copied to clipboard
open override val encodedUserInfo: String?

Gets the encoded user information from the authority. For example, if the authority is "nobody@google.com", this method will return "nobody".

Link copied to clipboard
open override val fragment: String?

Gets the decoded fragment part of this URI, everything after the '#'.

Link copied to clipboard
open override val host: String

Gets the encoded host from the authority for this URL. For example, if the authority is "bob@google.com", this method will return "google.com".

Link copied to clipboard
open override val isAbsolute: Boolean

Returns true if this URI is absolute, i.e. if it contains an explicit scheme.

Link copied to clipboard
open override val isHierarchical: Boolean

Returns true if this URI is hierarchical like "http://google.com". Absolute URIs are hierarchical if the scheme-specific part starts with a '/'. Relative URIs are always hierarchical.

Link copied to clipboard
open override val isOpaque: Boolean

Returns true if this URI is opaque like "mailto:nobody@google.com". The scheme-specific part of an opaque URI cannot start with a '/'.

Link copied to clipboard
open override val isRelative: Boolean

Returns true if this URI is relative, i.e. if it doesn't contain an explicit scheme.

Link copied to clipboard
open override val lastPathSegment: String?

Gets the decoded last segment in the path.

Link copied to clipboard
open override val path: String?

Gets the decoded path.

Link copied to clipboard
open override val pathSegments: List<String>

Gets the decoded path segments.

Link copied to clipboard
open override val port: Int

Gets the port from the authority for this URI. For example, if the authority is "google.com:80", this method will return 80.

Link copied to clipboard
open override val query: String?

Gets the decoded query component from this URI. The query comes after the query separator ('?') and before the fragment separator ('#'). This method would return "q=android" for "http://www.google.com/search?q=android".

Link copied to clipboard
open override val scheme: String

Gets the scheme of this URL. Example: "http"

Link copied to clipboard
open override val schemeSpecificPart: String

Gets the scheme-specific part of this URI, i.e. everything between the scheme separator ':' and the fragment separator '#'. Decodes escaped octets.

Link copied to clipboard
open override val userInfo: String?

Gets the decoded user information from the authority. For example, if the authority is "nobody@google.com", this method will return "nobody".

Functions

Link copied to clipboard
open override fun buildUpon(): Url.Builder

Constructs a new builder, copying the attributes from this Uri.

Link copied to clipboard
open operator override fun compareTo(other: Uri): Int
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Compares this Url to another object for equality. Returns true if the encoded string representations of this Url and the given Url are equal. Case counts. Paths are not normalized. If one Url specifies a default port explicitly and the other leaves it implicit, they will not be considered equal.

Link copied to clipboard
open override fun getBooleanQueryParameter(key: String, defaultValue: Boolean): Boolean

Searches the query string for the first value with the given key and interprets it as a boolean value. "false" and "0" are interpreted as false, everything else is interpreted as true.

Link copied to clipboard
open override fun getQueryParameter(key: String): String?

Searches the query string for the first value with the given key.

Link copied to clipboard
open override fun getQueryParameterNames(): Set<String>

Returns a set of the unique names of all query parameters. Iterating over the set will return the names in order of their first occurrence.

Link copied to clipboard
open override fun getQueryParameters(key: String): List<String>

Searches the query string for parameter values with the given key.

Link copied to clipboard
open override fun hashCode(): Int

Hashes the encoded string representation of this Url consistently with .equals.

Link copied to clipboard
open override fun normalizeScheme(): Url

Return an equivalent URL with a lowercase scheme component. This aligns the Url with Android best practices for intent filtering.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Uri.toNSURL(): NSURL?
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun Uri.toURI(): URI
fun Url.toURI(): URI
Link copied to clipboard
toURL
Link copied to clipboard
fun Url.toURL(): URL
fun Url.toURL(): URL
toURLOrNull
Link copied to clipboard