Build 1.0_r1(from source)

android.net
Class Uri.Builder

java.lang.Object
  extended by android.net.Uri.Builder
Enclosing class:
Uri

public static final class Uri.Builder
extends Object

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>


Constructor Summary
Uri.Builder()
          Constructs a new Builder.
 
Method Summary
 Uri.Builder appendEncodedPath(String newSegment)
          Appends the given segment to the path.
 Uri.Builder appendPath(String newSegment)
          Encodes the given segment and appends it to the path.
 Uri.Builder appendQueryParameter(String key, String value)
          Encodes the key and value and then appends the parameter to the query string.
 Uri.Builder authority(String authority)
          Encodes and sets the authority.
(package private)  Uri.Builder authority(Uri.Part authority)
           
 Uri build()
          Constructs a Uri with the current attributes.
 Uri.Builder encodedAuthority(String authority)
          Sets the previously encoded authority.
 Uri.Builder encodedFragment(String fragment)
          Sets the previously encoded fragment.
 Uri.Builder encodedOpaquePart(String opaquePart)
          Sets the previously encoded opaque scheme-specific-part.
 Uri.Builder encodedPath(String path)
          Sets the previously encoded path.
 Uri.Builder encodedQuery(String query)
          Sets the previously encoded query.
 Uri.Builder fragment(String fragment)
          Encodes and sets the fragment.
(package private)  Uri.Builder fragment(Uri.Part fragment)
           
 Uri.Builder opaquePart(String opaquePart)
          Encodes and sets the given opaque scheme-specific-part.
(package private)  Uri.Builder opaquePart(Uri.Part opaquePart)
           
 Uri.Builder path(String path)
          Sets the path.
(package private)  Uri.Builder path(Uri.PathPart path)
           
 Uri.Builder query(String query)
          Encodes and sets the query.
(package private)  Uri.Builder query(Uri.Part query)
           
 Uri.Builder scheme(String scheme)
          Sets the scheme.
 String toString()
          Returns a string containing a concise, human-readable description of the receiver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Uri.Builder

public Uri.Builder()
Constructs a new Builder.

Method Detail

scheme

public Uri.Builder scheme(String scheme)
Sets the scheme.

Parameters:
scheme - name or null if this is a relative Uri

opaquePart

Uri.Builder opaquePart(Uri.Part opaquePart)

opaquePart

public Uri.Builder opaquePart(String opaquePart)
Encodes and sets the given opaque scheme-specific-part.

Parameters:
opaquePart - decoded opaque part

encodedOpaquePart

public Uri.Builder encodedOpaquePart(String opaquePart)
Sets the previously encoded opaque scheme-specific-part.

Parameters:
opaquePart - encoded opaque part

authority

Uri.Builder authority(Uri.Part authority)

authority

public Uri.Builder authority(String authority)
Encodes and sets the authority.


encodedAuthority

public Uri.Builder encodedAuthority(String authority)
Sets the previously encoded authority.


path

Uri.Builder path(Uri.PathPart path)

path

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


encodedPath

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


appendPath

public Uri.Builder appendPath(String newSegment)
Encodes the given segment and appends it to the path.


appendEncodedPath

public Uri.Builder appendEncodedPath(String newSegment)
Appends the given segment to the path.


query

Uri.Builder query(Uri.Part query)

query

public Uri.Builder query(String query)
Encodes and sets the query.


encodedQuery

public Uri.Builder encodedQuery(String query)
Sets the previously encoded query.


fragment

Uri.Builder fragment(Uri.Part fragment)

fragment

public Uri.Builder fragment(String fragment)
Encodes and sets the fragment.


encodedFragment

public Uri.Builder encodedFragment(String fragment)
Sets the previously encoded fragment.


appendQueryParameter

public Uri.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

build

public Uri build()
Constructs a Uri with the current attributes.

Throws:
UnsupportedOperationException - if the URI is opaque and the scheme is null

toString

public String toString()
Description copied from class: Object
Returns a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class Object
Returns:
String a printable representation for the receiver.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature