<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="5" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[5]</anchor-end>
<cite>URI Expressions</cite> <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://www.erights.org/elang/io/uri-exprs.html" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">http://www.erights.org/elang/io/uri-exprs.html</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="6" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[6]</anchor-end></p><blockquote><figure><p>ERights Home / elang / io 
No Previous Sibling 		On to: Text File I/O</p><p>URI Expressions
The URI Literal Expression</p><p>Example 	Meaning 	Value
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="c:/jabbertest/jabberwocky.txt" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">c:/jabbertest/jabberwocky.txt</anchor-external> 	A file on the local file system 	a java.io.File object
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://www.erights.org" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">http://www.erights.org</anchor-external> 	A web page 	a java.net.URL object
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="import:java.util.Vector" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">import:java.util.Vector</anchor-external> 	Load a Java class or an EMaker 	the Class object for Vector
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="cap:***actual persistent object" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">cap:***actual persistent object</anchor-external> 	Sturdy Reference 	A remote E object</p><p>The URLs familiar from web browsing -- such as http://www.erights.org -- are actually a special case of a syntax known as a URI. (Not that it matters, but URL stands for Uniform Resource Locator, while URI stands for Uniform Resource Identifier.) E's grammar recognizes legal URIs (and therefore, legal URLs) enclosed in angle brackets as URI literal expressions. A URI literal expression starts with a protocol-identifier, such as &quot;http&quot; or &quot;file&quot;, is followed immediately by a colon, which is immediately followed by the uri-body characters, such as &quot;//www.erights.org&quot; or &quot;/jabberwocky.txt&quot;:</p><pre>    <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="protocol-identifier:uri-body" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">protocol-identifier:uri-body</anchor-external></pre><p>The protocol-identifier is a simple identifier that names a URI-protocol handler. It is up to the named handler to interpret the uri-body and return the value of the URI expression. The value of a URI expression will usually depend on which protocol handler is named. The URI body must begin with one of these characters:</p><pre>    a-z, A-Z, 0-9, any of ;/?@&amp;+$-_.!~*'().%#\|</pre><p>After the first character, the URI body consists of characters from this set, plus &quot;=&quot; and &quot;:&quot;.</p><section><section><section><h1>details: E doesn't quite recognize all legal URIs. The exceptions are the exclusion of &quot;=&quot; and &quot;:&quot; from the first uri-body character -- since it would cause confusion with &quot;:=&quot; (assignment) and &quot;::&quot; (reserved for future use). ***</h1></section><section><h1>details: \ and | are not actually legal URI characters, but appear in Netscape and/or Internet Explorer (clarify this) to mean / and : respectively. Accordingly, E normalizes \ to / and | to : before passing these to the protocol handler. ***</h1><p>The URI Unary Expression (left associative)</p><p>Example 	Meaning 	Value
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="file: expr" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">file: expr</anchor-external> 	use a calculated value 	the File whose name is the value of expr</p><p>To look up a file or a web page using a calculated name, rather than a name you know when you write the program, use the URI unary expression:</p><pre>    <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="protocol-name: expression" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">protocol-name: expression</anchor-external></pre><p>So, for example, both</p><pre>    def name := &quot;c:/jabbertest/jabberwocky.txt&quot;
    <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="file: name" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">file: name</anchor-external></pre><p>and</p><pre>    <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="file:c:/jabbertest/jabberwocky.txt" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">file:c:/jabbertest/jabberwocky.txt</anchor-external></pre><p>mean the same thing. You can also use the URI unary expression to look up names that contain non-URI characters. For example, Windows machines have a top level directory names &quot;Program Files&quot;. Since this name contains a space, you can't use the URI literal expression. But</p><pre>    <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="file: &quot;/Program Files&quot;" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">file: &quot;/Program Files&quot;</anchor-external></pre><p>is just as good.
The &quot;file:&quot; URI</p><p>See Text File I/O.</p></section><section><h1>detail: to accomodate the way modern browsers operate on windows, a one-letter protocol handler is assumed to be a drive letter and turned into a file: uri whose body consists of the original uri. For example,</h1><pre>    <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="a:/jabberwocky.txt" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">a:/jabberwocky.txt</anchor-external></pre><p>is turned into</p><pre>    <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="file:a:/jabberwocky.txt" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI">file:a:/jabberwocky.txt</anchor-external></pre><p>which will fetch the file from your A drive (typically, a floppy). ***
Standard URLs (http:, ftp:, gopher:, news:, and mailto:)</p><p>These all evaluate to java.net.URL objects. See URLs.
The &quot;import:&quot; URI</p><blockquote><p>After &quot;import:&quot; comes a Java fully qualified class name. If there is a class by this name (or if one can be loaded), that class is the value of this expression. This enables the equivalent of Java's import statement.</p></blockquote></section></section></section></figure></blockquote></body></html>