Builder

class Builder(uriBuilder: Uri.Builder = Uri.Builder()) : UrlBuilder, Builder

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

An absolute hierarchical URL reference follows the pattern: <scheme>://<authority><absolute path>?<query>#<fragment>

An opaque URI follows this pattern: <scheme>:<opaque part>#<fragment>

Use Url.buildUpon to obtain a builder representing an existing URL.

Constructors

Link copied to clipboard
constructor(uriBuilder: Uri.Builder = Uri.Builder())

Functions

Link copied to clipboard
open override fun appendEncodedPath(newSegment: String): Builder

Appends the given segment to the path.

Link copied to clipboard
open override fun appendPath(newSegment: String): Builder

Encodes the given segment and appends it to the path.

Link copied to clipboard
open override fun appendQueryParameter(key: String, value: String?): Builder

Encodes the key and value and then appends the parameter to the query string.

Link copied to clipboard
open override fun authority(authority: String): Url.Builder
open override fun authority(authority: String?): Builder

Encodes and sets the authority.

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

Constructs a Url with the current attributes.

Link copied to clipboard
open override fun clearQuery(): Builder

Clears the the previously set query.

Link copied to clipboard
open override fun encodedAuthority(authority: String): Url.Builder
open override fun encodedAuthority(authority: String?): Builder

Sets the previously encoded authority.

Link copied to clipboard
open override fun encodedFragment(fragment: String?): Builder

Sets the previously encoded fragment.

Link copied to clipboard
open override fun encodedOpaquePart(opaquePart: String): Url.Builder
open override fun encodedOpaquePart(opaquePart: String?): Builder

Sets the previously encoded opaque scheme-specific-part.

Link copied to clipboard
open override fun encodedPath(path: String?): Builder

Sets the previously encoded path.

Link copied to clipboard
open override fun encodedQuery(query: String?): Builder

Sets the previously encoded query.

Link copied to clipboard
open override fun fragment(fragment: String?): Builder

Encodes and sets the fragment.

Link copied to clipboard
open override fun opaquePart(opaquePart: String): Url.Builder
open override fun opaquePart(opaquePart: String?): Builder

Encodes and sets the given opaque scheme-specific-part.

Link copied to clipboard
open override fun path(path: String?): Builder

Sets the path. Leaves '/' characters intact but encodes others as necessary.

Link copied to clipboard
open override fun query(query: String?): Builder

Encodes and sets the query.

Link copied to clipboard
open override fun scheme(scheme: String): Url.Builder
open override fun scheme(scheme: String?): Builder

Sets the scheme.

Link copied to clipboard
open override fun toString(): String