Copyright (C) 1994, Digital Equipment Corp.A
FileRd.T, or file reader, is a reader on a File.T.
\index{buffered file I/O}
\index{file!buffered I/O}
INTERFACEFileRd ; IMPORT Rd, File, OSError, Pathname; TYPE T <: Public; Public = Rd.T OBJECT METHODS init(h: File.T): T RAISES {OSError.E} END;
Ifris a file reader andhis a file handle, the callr.init(h)initializesrso that readingrreads characters fromh, and so that closingrclosesh.
If
h is a regular file handle, r.init(h) causes r to be a
nonintermittent, seekable reader and initializes cur(r) to
cur(h).
For any other file handle h, r.init(h) causes r to be an
intermittent, nonseekable reader and initializes cur(r) to zero.
If a subsequent reader operation on r raises Rd.Failure, the
associated exception argument is the AtomList.T argument
accompanying an OSError.E exception from a file operation on h.
PROCEDURE Open(p: Pathname.T): T RAISES {OSError.E};
Return a file reader whose source is the file namedp. If the file does not exist,OSError.Eis raised with an implementation-defined code.
The call
Open(p) is equivalent to
RETURN NEW(T).init(FS.OpenFileReadonly(p))
END FileRd.