【Android】Uri和Url和URN
最早在Android方面接觸這兩個概念,是學習ContentProvider的時候,當時花了很多時間,始終不能很好的理解他們的區(qū)別,順帶著ContentProvider的用法也無法理解,最近通過實現(xiàn)網頁鏈接和Android-APP的無縫跳轉問題,對這里的區(qū)別有了一定的認識。
下面是來自StackOverFlow上的一段解釋What's the difference between a URI and a URL?:
A URI can be further classified as a locator, a name, or both. The term "Uniform Resource Locator" (URL) refers to the subset of URIs that, in addition to identifying a resource, provide a means of locating the resource by describing its primary access mechanism (e.g., its network "location"). The term "Uniform Resource Name" (URN) has been used historically to refer to both URIs under the "urn" scheme [RFC2141], which are required to remain globally unique and persistent even when the resource ceases to exist or becomes unavailable, and to any other URI with the properties of a name.
URI(Uniform Resource Identifier)中文名為統(tǒng)一資源標識符。
URL(Uniform Resource Locator)中文名字為統(tǒng)一資源定位符。
Examples
- Roger Pate
This is my name, which is identification. It is like a URI, but cannot be a URL, as it tells you nothing about my location or how to contact me. In this case it also happens to identify at least 5 other people in the USA alone.
- 4914 West Bay Street, Nassau, Bahamas
This is a location, which is identification for that physical location. It is like both a URL and URI (since all URLs are URIs), and also identifies me?indirectly?as "resident of..". In this case it uniquely identifies me, but that would change if I get a roommate.
I say "like" because these examples do not follow the required syntax.
URIs identify?and?URLs locate; however,?locations are also identifications, so every URL is also a URI, but there are URIs which are not URLs.
?
在Wikipedia上面,解釋如下:
URIs can be classified as locators (URLs), as names (URNs), or as both. A?uniform resource name?(URN) functions like a person's name, while a?uniform resource locator?(URL) resembles that person's street address. In other words: the URN defines an item's identity, while the URL provides a method for finding it.
A?uniform resource locator, abbreviated?URL, also known as?web address, is a specific?character string?that constitutes a reference to a resource. In most?web browsers, the URL of a web page is displayed on top inside an?address bar. An example of a typical URL would be?"http://en.example.org/wiki/Main_Page".
三者的關系如下:
?
?
OK,上面一大段英文之后,如果看懂了,基本上有了一個大概的了解,URN確定了一個資源的身份,比如,我可以叫你為大腳印,大腳印標志了你的身份,但是我應該如何找到你呢?XX學校XX班級的大腳印!這是一個URL(但是其實根據上面URL的定義,URL定義的應該是網址,我的理解是,URL代表著URI的一種形式,URI中用來標志一個資源位置的方式還有很多,最常見的比如文件系統(tǒng)中的某個文件的絕對地址),通過這個URL我們可以找到這個資源!URL和URN同統(tǒng)一包含于URI。
下面我去整理一下ContentProvider的有關文章。
?
轉載于:https://www.cnblogs.com/lqminn/archive/2013/04/20/3031949.html
總結
以上是生活随笔為你收集整理的【Android】Uri和Url和URN的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [转载] 杜拉拉升职记——39 充满变数
- 下一篇: 一键解决局域网共享(批处理)