# URI:Scheme:File

### Import List

        IO
        Object
        Object
        RT0
        URI
        URI:Scheme:Hierarchical

Class List
URI |

Class Summary: URI [Detail]

      +---RT0.Object
           |
           +---Object.Object
                |
                +---URI.URI
                     |
                     +---URI.HierarchicalURI
                          |
                          +---URI:Scheme:Hierarchical.Generic
                               |
                               +--URI:Scheme:File.URI

Inherited Fields
From URI.URI: schemeId From URI.HierarchicalURI: authority, query From URI:Scheme:Hierarchical.Generic: absolutePath, pathList
Constructor Summary
GetCwd(): URI Creates an absolute file URI for the current working directory.
Init(URI, STRING, Authority, Query)
New(STRING, Authority, Query): URI
NewPrototype(): URI
ToURI(ARRAY OF CHAR): URI Constructs a ``file:`' URI for a given file path.
Method Summary
AuthorityMandatory(): BOOLEAN If TRUE and the URI has a scheme component, then require that an authority is present when parsing the URI, and include an empty authority part when converting the URI to a string, if no authority is defined.
Clone(): URI Creates a deep copy of the URI referenced by file.
GetChannel(ChannelMode): ByteChannel Opens a channel to the resource indicated by URI file.
GetPath(): String8 Returns the file path associated with the URI file.
NewAuthority(): Authority Creates a new instance of the authority component of URI file.
NewQuery(): Query Creates a new instance of the query component of URI file.
Inherited Methods
From RT0.Object: Finalize From Object.Object: Equals, HashCode From URI.URI: AppendScheme, GetChannel, SetSchemeId From URI.HierarchicalURI: AuthorityMandatory, SetAuthority, SetQuery From URI:Scheme:Hierarchical.Generic: AppendPath, AppendSegment, ClearPath, Clone, Copy, MakeRelative, NewAuthority, NewQuery, ParsePath, RemoveSegment, ResolveRelative, StripSegments, ToString, WriteXML

Class Detail: URI

Constructor Detail

### GetCwd

    PROCEDURE GetCwd(): URI

> Creates an absolute file URI for the current working directory. If the current working directory cannot be determined, the value NIL is returned.

> Pre-condition: The URL scheme "file" must have been registered with URI.RegisterScheme.

### Init

    PROCEDURE Init(file: URI;
                   schemeId: STRING;
                   authority: Authority;
                   query: Query)

### New

    PROCEDURE New(schemeId: STRING;
                  authority: Authority;
                  query: Query): URI

### NewPrototype

    PROCEDURE NewPrototype(): URI

### ToURI

    PROCEDURE ToURI(filePath: ARRAY OF CHAR): URI

> Constructs a ``file:`' URI for a given file path. Characters that are not valid within an URI are escaped.

Method Detail

### AuthorityMandatory

    PROCEDURE (file: URI) AuthorityMandatory(): BOOLEAN

> If TRUE and the URI has a scheme component, then require that an authority is present when parsing the URI, and include an empty authority part when converting the URI to a string, if no authority is defined.

> By default, this method returns FALSE.

> [Description inherited from AuthorityMandatory]

> Redefines: AuthorityMandatory, AuthorityMandatory

### Clone

    PROCEDURE (file: URI) Clone(): URI

> Creates a deep copy of the URI referenced by file. That is, it creates a new instance of file and calls URI.Copy on it.

> [Description inherited from Clone]

> Redefines: Clone, Clone, Clone

### GetChannel

    PROCEDURE (file: URI) GetChannel(mode: ChannelMode): ByteChannel
      RAISES Error;

> Opens a channel to the resource indicated by URI file. Depending on mode, one of these operations is performed:

> channelNew | Opens a channel to a new instance of the resource. If the resource exists, it is truncated. The channel is opened for both read and write access.
> channelTmp | Opens a channel to a new instance of the resource, but does not register the resource within its naming service. The channel is opened for both read and write access. Please note that some channel operations do not support this operation. For those that do, registration of the resource in the naming service depends on the channel implementation.
> channelOld | Opens a channel to an existing resource. Only read access is enabled.

> On success, a channel instance is returned. On failure, an exception of type IO.Error is raised.

> Note: Currently, only the ``file`' URI (URI:Scheme:File) and the ``http`' URI (URI:Scheme:HTTP) support this method.

> [Description inherited from GetChannel]

> Redefines: GetChannel, GetChannel, GetChannel

### GetPath

    PROCEDURE (file: URI) GetPath(): String8

> Returns the file path associated with the URI file. On a Unix system, this is identical to the URI's path component.

### NewAuthority

    PROCEDURE (file: URI) NewAuthority(): Authority

> Creates a new instance of the authority component of URI file. The new object is subsequently filled in by parsing the authority component of the URI string (see URI:Authority.ParseAuthority).

> [Description inherited from NewAuthority]

> Redefines: NewAuthority, NewAuthority

### NewQuery

    PROCEDURE (file: URI) NewQuery(): Query

> Creates a new instance of the query component of URI file. The new object is subsequently filled in by parsing the query component of the URI string (see URI:Query.ParseQuery).

> [Description inherited from NewQuery]

> Redefines: NewQuery, NewQuery