[5] [CITE[URI Expressions]] [6] > [FIG[ ERights Home / elang / io No Previous Sibling On to: Text File I/O URI Expressions The URI Literal Expression Example Meaning Value A file on the local file system a java.io.File object A web page a java.net.URL object Load a Java class or an EMaker the Class object for Vector Sturdy Reference A remote E object 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 "http" or "file", is followed immediately by a colon, which is immediately followed by the uri-body characters, such as "//www.erights.org" or "/jabberwocky.txt": [PRE[ ]PRE] 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: [PRE[ a-z, A-Z, 0-9, any of ;/?@&+$-_.!~*'().%#\| ]PRE] After the first character, the URI body consists of characters from this set, plus "=" and ":". *** details: E doesn't quite recognize all legal URIs. The exceptions are the exclusion of "=" and ":" from the first uri-body character -- since it would cause confusion with ":=" (assignment) and "::" (reserved for future use). *** *** 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. *** The URI Unary Expression (left associative) Example Meaning Value use a calculated value the File whose name is the value of expr 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: [PRE[ ]PRE] So, for example, both [PRE[ def name := "c:/jabbertest/jabberwocky.txt" ]PRE] and [PRE[ ]PRE] 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 "Program Files". Since this name contains a space, you can't use the URI literal expression. But [PRE[ ]PRE] is just as good. The "file:" URI See Text File I/O. *** 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, [PRE[ ]PRE] is turned into [PRE[ ]PRE] which will fetch the file from your A drive (typically, a floppy). *** Standard URLs (http:, ftp:, gopher:, news:, and mailto:) These all evaluate to java.net.URL objects. See URLs. The "import:" URI > After "import:" 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. ]FIG]