import:

import: URL scheme

[5] URI Expressions <http://www.erights.org/elang/io/uri-exprs.html>

[6]

ERights Home / elang / io No Previous Sibling On to: Text File I/O

URI Expressions The URI Literal Expression

Example Meaning Value <c:/jabbertest/jabberwocky.txt> A file on the local file system a java.io.File object <http://www.erights.org> A web page a java.net.URL object <import:java.util.Vector> Load a Java class or an EMaker the Class object for Vector <cap:***actual persistent object> 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":

    <protocol-identifier:uri-body>

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:

    a-z, A-Z, 0-9, any of ;/?@&+$-_.!~*'().%#\|

After the first character, the URI body consists of characters from this set, plus "=" and ":".

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,

    <a:/jabberwocky.txt>

is turned into

    <file:a:/jabberwocky.txt>

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.