22

I have recently come across an android object that makes no sense to me. I can't understand what is an URI?

Well I checked the Official Documentation and it said:

Immutable URI reference. A URI reference includes a URI and a fragment, the component of the URI following a '#'. Builds and parses URI references which conform to RFC 2396.

The problem is, you can't use a URI to explain what is a URI! I am totally confused.

I did some research and came across this article. But it said

Uri does nothing

Could someone please explain to me what does this mean!

Community
  • 1
  • 1
Fish
  • 1,579
  • 1
  • 13
  • 27
  • 3
    https://en.wikipedia.org/wiki/Uniform_resource_identifier – Karakuri Jul 24 '15 at 00:09
  • 7
    URI is like a URL on the internet (Uniform Resource Locator) but wider in scope. eg `file:///something.txt`, `http://www.example.com/`, `ftp://example.com`. Each different string before the `:` indicates a different protocol/handler. In Android, URIs are used to point at other apps, actions, etc eg `tel:+44123456789`. See [here](http://stackoverflow.com/a/2498596/156755) for an example using a Uri to make a phone call – Basic Jul 24 '15 at 00:11
  • possible duplicate of [What is the difference between a URI, a URL and a URN](http://stackoverflow.com/questions/176264/what-is-the-difference-between-a-uri-a-url-and-a-urn) – StephenG Jul 24 '15 at 00:15
  • [This](http://www.faqs.org/rfcs/rfc2396.html) RFC Document might help. – Sahil Singh May 23 '20 at 19:59

3 Answers3

29
  1. Q: What is a "URI"?

    A: The technical meaning of "URI" is defined in RFC 2396:

A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource.

  1. Q: What is an Android "URI" class?

    A: Here is the Javadoc for android.net.Uri

  2. Q: But what do we need the Android "URI" class for?

    A: Look at the "Content Providers" section of the Android documentation:

http://developer.android.com/guide/topics/providers/content-providers.html

Content providers manage access to a structured set of data. They encapsulate the data, and provide mechanisms for defining data security. Content providers are the standard interface that connects data in one process with code running in another process.

For example...

public final ContentProviderClient acquireContentProviderClient (Uri uri)

Returns a ContentProviderClient that is associated with the ContentProvider that services the content at uri, starting the provider if necessary.

If you're curious, here's what Tim Berners-Lee had to say about URIs (he's the guy who invented them ;)):

http://www.w3.org/DesignIssues/Axioms.html#uri

Universal Resource Identifiers

The Web is a universal information space. It is a space in the sense that things in it have an address. The "addresses", "names", or as we call them here identifiers, are the subject of this article. They are called Universal Resource Identifiers (URIs).

An information object is "on the web" if it has a URI. Objects which have URIs are sometimes known as "First Class Objects" (FCOs). The Web works best when any information object of value and identity is a first class object. If something does not have a URI, you can't refer to it, and the power of the Web is the less for that.

By Universal I mean that the web is declared to be able to contain in principle every bit of information accessible by networks. It was designed to be able to include existing information systems such as FTP, and to be able simply in the future to be extendable to include any new information system.

The URI schemes identify things various different types of information object, wich play different roles in the protocols. Some identify services, connection end points, and so on, but a fundamental underlying architectural notion is of information objects - otherwise known as generic documents. These can be represented by strings of bits. An information object conveys something - it may be art, poetry, sensor values or mathematical equations.

paulsm4
  • 99,714
  • 15
  • 125
  • 160
  • One question I failed to answer: Q: What is an Android "URI Reference"? Look [here](http://developer.android.com/reference/android/net/Uri.Builder.html), in the "Class Overview" section of Uri.Builder. This also answers the question about "URI" vs. "URI fragment". – paulsm4 Jul 24 '15 at 00:25
2

URI(Uniform resource identifier) as its name suggests is used to identify resource(whether it be a page of text, a video or sound clip, a still or animated image, or a program).

The most common form of URI is the Web page address, which is a particular form or subset of URI called a Uniform Resource Locator (URL).

Android uses URI string as the basis for requesting data in a content provider (i.e. to retrieve a list of contacts) and for requesting actions (i.e. opening a webpage in a browser)

Anand Prakash
  • 361
  • 2
  • 9
1

I am adding details from RFC that center around the abbreviation URI and some examples in use:

From,
http://www.faqs.org/rfcs/rfc2396.html

This document updates and merges "Uniform Resource Locators"
[RFC1738] and "Relative Uniform Resource Locators" [RFC1808] in order to define a single, generic syntax for all URI.

And,

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

mailto:mduerst@ifi.unizh.ch -- 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

Manish Kumar Sharma
  • 11,112
  • 7
  • 50
  • 86