问题 android中的URI是什么


我最近遇到了一个对我没用的android对象。我无法理解什么是URI?

好吧,我查了一下 官方文件 它说:

不可变的URI引用。 URI引用包括URI和   fragment,'#'后面的URI组件。构建和解析   符合RFC 2396的URI引用。

问题是,你不能使用URI来解释什么是URI!我完全糊涂了。

我做了一些研究并遇到过 本文。但它说

Uri什么都不做

有人可以向我解释这是什么意思!


1984
2017-07-24 00:07


起源

en.wikipedia.org/wiki/Uniform_resource_identifier - Karakuri
URI就像互联网上的URL(统一资源定位器),但范围更广。例如 file:///something.txt, http://www.example.com/, ftp://example.com。每个不同的字符串之前 : 表示不同的协议/处理程序。在Android中,URI用于指向其他应用程序,操作等,例如 tel:+44123456789。看到 这里 例如,使用Uri拨打电话 - Basic
可能重复 URI,URL和URN之间有什么区别 - StephenG


答案:


  1. 问:什么是“URI”?

    答:“URI”的技术含义在中定义 RFC 2396

统一资源标识符(URI)是一个紧凑的序列   标识抽象或物理资源的字符。

  1. 问:什么是Android“URI”类?

    答:这是Javadoc for android.net.Uri

  2. 问:但我们做了什么 需要 Android“URI”类适合?

    答:请查看Android文档的“内容提供商”部分:

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

内容提供商管理对结构化数据集的访问。他们   封装数据,并提供定义数据的机制   安全。内容提供程序是连接的标准接口   代码在另一个进程中运行的一个进程中的数据。

例如...

public final ContentProviderClient acquireContentProviderClient (Uri uri)

返回与之关联的ContentProviderClient   ContentProvider为uri的内容提供服务,启动   提供者如有必要。

如果你很好奇,这就是Tim Berners-Lee对URI的看法(他是发明它们的人;)):

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

通用资源标识符

Web是一个通用的信息空间。这是一个意义上的空间   它里面的东西都有一个地址。 “地址”,“名称”或我们   在这里称呼它们为标识符,是本文的主题。他们是   称为统一资源标识符(URI)。

如果信息对象具有URI,则该信息对象在“Web上”。对象   URI有时被称为“第一类对象”(FCO)。该   当任何有价值和身份的信息对象是a时,Web效果最佳   第一类对象。如果某些内容没有URI,则无法引用   对它来说,网络的力量就是那么少。

通用我的意思是宣布网络能够包含   原则是网络可以访问的每一点信息。它是   旨在能够包括现有的信息系统,如   FTP,并且能够在将来简单地扩展到包括   任何新的信息系统。

URI方案识别各种不同类型的信息   对象,在协议中扮演不同的角色。有些人认同   服务,连接端点等,但一个基础   基础架构概念是信息对象 - 否则   称为通用文件。这些可以用字符串表示   位。信息对象传达了一些东西 - 它可能是艺术,诗歌,   传感器值或数学方程式。


15
2017-07-24 00:15



我没有回答的一个问题:问:什么是Android“URI参考”?看 这里,在Uri.Builder的“类概述”部分。这也回答了关于“URI”与“URI片段”的问题。 - paulsm4


URI(统一资源标识符)顾名思义用于标识资源(无论是文本页面,视频或声音片段,静止或动画图像,还是程序)。

最常见的URI形式是Web页面地址,它是URI的特定形式或子集,称为统一资源定位符(URL)。

Android使用URI字符串作为在内容提供商中请求数据(即检索联系人列表)和请求操作(即在浏览器中打开网页)的基础


0
2017-07-24 00:25





我正在添加RFC的详细信息,其中包含缩写URI和一些使用示例:

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

本文档更新并合并“统一资源定位器”
  [RFC1738]和“相对统一资源定位符”[RFC1808]按顺序排列   为所有URI定义单个通用语法。

和,

1.1 URI概述

URI的特征在于以下定义:

  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.

以下是一些使用中:

1.3。示例URI

以下示例说明了常用的URI。

ftp://ftp.is.co.za/rfc/rfc1808.txt          - 文件传输协议服务的ftp方案

鼠://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles          - Gopher和Gopher +协议服务的gopher方案

http://www.math.uio.no/faq/compression-faq/part1.html          - 用于超文本传输​​协议服务的http方案

邮寄地址:mduerst@ifi.unizh.ch          - 电子邮件地址的mailto方案

新闻:comp.infosystems.www.servers.unix          - USENET新闻组和文章的新闻计划

远程登录://melvyl.ucop.edu/          - 通过TELNET协议进行交互式服务的telnet方案


0
2017-12-04 11:19