English | Site Directory

Android - An Open Handset Alliance Project

android.net
public static final class

android.net.Uri.Builder

java.lang.Object
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: ://?#

Relative URI references (which are always hierarchical) follow one of two patterns: ?# or //?#

An opaque URI follows this pattern: :#

Summary

Public Constructors

          Uri.Builder()
Constructs a new Builder.

Public Methods

        Builder  appendEncodedPath(String newSegment)
Appends the given segment to the path.
        Builder  appendPath(String newSegment)
Encodes the given segment and appends it to the path.
        Builder  appendQueryParameter(String key, String value)
Encodes the key and value and then appends the parameter to the query string.
        Builder  authority(String authority)
Encodes and sets the authority.
        Uri  build()
Constructs a Uri with the current attributes.
        Builder  encodedAuthority(String authority)
Sets the previously encoded authority.
        Builder  encodedFragment(String fragment)
Sets the previously encoded fragment.
        Builder  encodedOpaquePart(String opaquePart)
Sets the previously encoded opaque scheme-specific-part.
        Builder  encodedPath(String path)
Sets the previously encoded path.
        Builder  encodedQuery(String query)
Sets the previously encoded query.
        Builder  fragment(String fragment)
Encodes and sets the fragment.
        Builder  opaquePart(String opaquePart)
Encodes and sets the given opaque scheme-specific-part.
        Builder  path(String path)
Sets the path.
        Builder  query(String query)
Encodes and sets the query.
        Builder  scheme(String scheme)
Sets the scheme.
        String  toString()
Answers a string containing a concise, human-readable description of the receiver.
Methods inherited from class java.lang.Object

Details

Public Constructors

public Uri.Builder()

Constructs a new Builder.

Public Methods

public Builder appendEncodedPath(String newSegment)

Appends the given segment to the path.

public Builder appendPath(String newSegment)

Encodes the given segment and appends it to the path.

public Builder appendQueryParameter(String key, String value)

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

Parameters

key which will be encoded
value which will be encoded

public Builder authority(String authority)

Encodes and sets the authority.

public Uri build()

Constructs a Uri with the current attributes.

Throws

UnsupportedOperationException if the URI is opaque and the scheme is null

public Builder encodedAuthority(String authority)

Sets the previously encoded authority.

public Builder encodedFragment(String fragment)

Sets the previously encoded fragment.

public Builder encodedOpaquePart(String opaquePart)

Sets the previously encoded opaque scheme-specific-part.

Parameters

opaquePart encoded opaque part

public Builder encodedPath(String path)

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 '/'.

public Builder encodedQuery(String query)

Sets the previously encoded query.

public Builder fragment(String fragment)

Encodes and sets the fragment.

public Builder opaquePart(String opaquePart)

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

Parameters

opaquePart decoded opaque part

public Builder path(String path)

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 '/'.

public Builder query(String query)

Encodes and sets the query.

public Builder scheme(String scheme)

Sets the scheme.

Parameters

scheme name or null if this is a relative Uri

public String toString()

Answers a string containing a concise, human-readable description of the receiver.
Build m5-rc15i - 10 Jun 2008 13:54