Builder
class Builder
kotlin.Any | |
↳ | android.net.Uri.Builder |
Helper class for building or manipulating URI references. Not safe for concurrent use.
An absolute hierarchical URI reference follows the pattern: <scheme>://<authority><absolute path>?<query>#<fragment>
Relative URI references (which are always hierarchical) follow one of two patterns: <relative or absolute path>?<query>#<fragment>
or //<authority><absolute path>?<query>#<fragment>
An opaque URI follows this pattern: <scheme>:<opaque part>#<fragment>
Use Uri.buildUpon()
to obtain a builder representing an existing URI.
Summary
Public constructors | |
---|---|
Builder() Constructs a new Builder. |
Public methods | |
---|---|
Uri.Builder! |
appendEncodedPath(newSegment: String!) Appends the given segment to the path. |
Uri.Builder! |
appendPath(newSegment: String!) Encodes the given segment and appends it to the path. |
Uri.Builder! |
appendQueryParameter(key: String!, value: String!) Encodes the key and value and then appends the parameter to the query string. |
Uri.Builder! |
Encodes and sets the authority. |
Uri! |
build() Constructs a Uri with the current attributes. |
Uri.Builder! |
Clears the the previously set query. |
Uri.Builder! |
encodedAuthority(authority: String!) Sets the previously encoded authority. |
Uri.Builder! |
encodedFragment(fragment: String!) Sets the previously encoded fragment. |
Uri.Builder! |
encodedOpaquePart(opaquePart: String!) Sets the previously encoded opaque scheme-specific-part. |
Uri.Builder! |
encodedPath(path: String!) Sets the previously encoded path. |
Uri.Builder! |
encodedQuery(query: String!) Sets the previously encoded query. |
Uri.Builder! |
Encodes and sets the fragment. |
Uri.Builder! |
opaquePart(opaquePart: String!) Encodes and sets the given opaque scheme-specific-part. |
Uri.Builder! |
Sets the path. |
Uri.Builder! |
Encodes and sets the query. |
Uri.Builder! |
Sets the scheme. |
String |
toString() |
Public constructors
Public methods
appendEncodedPath
fun appendEncodedPath(newSegment: String!): Uri.Builder!
Appends the given segment to the path.
appendPath
fun appendPath(newSegment: String!): Uri.Builder!
Encodes the given segment and appends it to the path.
appendQueryParameter
fun appendQueryParameter(
key: String!,
value: String!
): Uri.Builder!
Encodes the key and value and then appends the parameter to the query string.
Parameters | |
---|---|
key |
String!: which will be encoded |
value |
String!: which will be encoded |
authority
fun authority(authority: String!): Uri.Builder!
Encodes and sets the authority.
build
fun build(): Uri!
Constructs a Uri with the current attributes.
Exceptions | |
---|---|
java.lang.UnsupportedOperationException |
if the URI is opaque and the scheme is null |
clearQuery
fun clearQuery(): Uri.Builder!
Clears the the previously set query.
encodedAuthority
fun encodedAuthority(authority: String!): Uri.Builder!
Sets the previously encoded authority.
encodedFragment
fun encodedFragment(fragment: String!): Uri.Builder!
Sets the previously encoded fragment.
encodedOpaquePart
fun encodedOpaquePart(opaquePart: String!): Uri.Builder!
Sets the previously encoded opaque scheme-specific-part.
Parameters | |
---|---|
opaquePart |
String!: encoded opaque part |
encodedPath
fun encodedPath(path: String!): Uri.Builder!
Sets the previously encoded path.
If the path is not null and doesn't start with a '/', and if you specify a scheme and/or authority, the builder will prepend the given path with a '/'.
encodedQuery
fun encodedQuery(query: String!): Uri.Builder!
Sets the previously encoded query.
fragment
fun fragment(fragment: String!): Uri.Builder!
Encodes and sets the fragment.
opaquePart
fun opaquePart(opaquePart: String!): Uri.Builder!
Encodes and sets the given opaque scheme-specific-part.
Parameters | |
---|---|
opaquePart |
String!: decoded opaque part |
path
fun path(path: String!): Uri.Builder!
Sets the path. Leaves '/' characters intact but encodes others as necessary.
If the path is not null and doesn't start with a '/', and if you specify a scheme and/or authority, the builder will prepend the given path with a '/'.
scheme
fun scheme(scheme: String!): Uri.Builder!
Sets the scheme.
Parameters | |
---|---|
scheme |
String!: name or null if this is a relative Uri |
toString
fun toString(): String
Return | |
---|---|
String |
a string representation of the object. |