What is the function of Uri
and how is Uri.parse()
used?
For example :
Uri.parse("tel:(+49)12345789"));
and
Uri.parse("geo:50.123,7.1434?z=19"));
What dotel
and geo
refer to ?
A URI is a uniform resource identifier while a URL is a uniform resource locator.
uriparser is a strictly RFC 3986 compliant URI parsing and handling library written in C89 ("ANSI C"). uriparser is cross-platform, fast, supports both char and wchar_t strings, and is licensed under the New BSD license.
A content URI is a URI that identifies data in a provider. Content URIs include the symbolic name of the entire provider (its authority) and a name that points to a table (a path). When you call a client method to access a table in a provider, the content URI for the table is one of the arguments.
parse method Null safetyCreates a new Uri object by parsing a URI string. If start and end are provided, they must specify a valid substring of uri , and only the substring from start to end is parsed as a URI. If the uri string is not valid as a URI or URI reference, a FormatException is thrown.
A Uri object is usually used to tell a ContentProvider what we want to access by reference. It is an immutable one-to-one mapping to a resource or data. The method Uri.parse
creates a new Uri
object from a properly formated String
. See here for more information about ContentProviders
.
1.1 Overview of URI
URI are characterized by the following definitions:
Uniform Uniformity provides several benefits: it allows different types of resource identifiers to be used in the same context, even when the mechanisms used to access those resources may differ; it allows uniform semantic interpretation of common syntactic conventions across different types of resource identifiers; it allows introduction of new types of resource identifiers without interfering with the way that existing identifiers are used; and, it allows the identifiers to be reused in many different contexts, thus permitting new applications or protocols to leverage a pre-existing, large, and widely-used set of resource identifiers. Resource A resource can be anything that has identity. Familiar examples include an electronic document, an image, a service (e.g., "today's weather report for Los Angeles"), and a collection of other resources. Not all resources are network "retrievable"; e.g., human beings, corporations, and bound books in a library can also be considered resources. The resource is the conceptual mapping to an entity or set of entities, not necessarily the entity which corresponds to that mapping at any particular instance in time. Thus, a resource can remain constant even when its content---the entities to which it currently corresponds---changes over time, provided that the conceptual mapping is not changed in the process. Identifier An identifier is an object that can act as a reference to something that has identity. In the case of URI, the object is a sequence of characters with a restricted syntax.
Here are some in use:
1.3. Example URI
The following examples illustrate URI that are in common use.
ftp://ftp.is.co.za/rfc/rfc1808.txt -- ftp scheme for File Transfer Protocol services
gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles -- gopher scheme for Gopher and Gopher+ Protocol services
http://www.math.uio.no/faq/compression-faq/part1.html -- http scheme for Hypertext Transfer Protocol services
[email protected] -- mailto scheme for electronic mail addresses
news:comp.infosystems.www.servers.unix -- news scheme for USENET news groups and articles
telnet://melvyl.ucop.edu/ -- telnet scheme for interactive services via the TELNET Protocol
References:
http://www.faqs.org/rfcs/rfc2396.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With