StreamOpen:
PROC [fileName:
ROPE,
accessOptions: FS.AccessOptions ← $read,
streamOptions: FS.StreamOptions ← FS.defaultStreamOptions,
keep:
CARDINAL ← 1,
createByteCount: FS.ByteCount ← 2560,
streamBufferParms: FS.StreamBufferParms ← FS.defaultStreamBufferParms,
extendFileProc: FS.ExtendFileProc ←
NIL,
wantedCreatedTime: BasicTime.
GMT ← BasicTime.nullGMT,
remoteCheck:
BOOL ←
TRUE,
wDir:
ROPE ←
NIL
]
RETURNS [
STREAM];
Create a new stream by (1) generating an FS.OpenFile from fileName, keep, and createByteCount, then (2) creating a stream on this FS.OpenFile.
(1) If accessOptions = $read, perform GeneralFS.Open[name: fileName, wantedCreatedTime: wantedCreatedTime, remoteCheck: remoteCheck, wDir: wDir]. If accessOptions = $create, perform GeneralFS.Create[name: fileName, keep: keep, pages: FS.PagesForBytes[createByteCount], wDir: wDir]. If accessOptions = $append, perform GeneralFS.OpenOrCreate[name: fileName, keep: keep, pages: FS.PagesForBytes[createByteCount], wDir: wDir]. If accessOptions = $write, perform GeneralFS.Open[name: fileName, lock: $write, wantedCreatedTime: wantedCreatedTime, remoteCheck: remoteCheck, wDir: wDir]. Any FS.Error raised by a call to GeneralFS.Open, GeneralFS.Create, or GeneralFS.OpenOrCreate will propogate through GeneralFS.StreamOpen.
(2) Perform FS.StreamFromOpenFile[ ... , streamOptions, streamBufferParms, extendFileProc] on the resulting FS.OpenFile. The value of accessOptions determines the set of operations allowed on the stream (disallowed operations raise IO.Error[$NotImplementedForThisStream, stream] when called), and the initial streamIndex, as follows:
read: PutChar, PutBlock, UnsafePutBlock, and SetLength are disallowed, and the initial streamIndex is 0.
create: all operations are allowed, the length is set to zero at stream creation time, and the initial streamIndex is 0.
append: all operations are allowed, and the initial streamIndex is the file's byte count.
write: all operations are allowed, and the initial streamIndex is 0.
Client errors: $noCache, $globalWriteLock, $zeroKeep
User errors: $nonCedarVolume, $unknownServer, $unknownVolume, $unknownFile, $illegalName, $patternNotAllowed, $versionSpecified, $globalCreation, $cantUpdateTiogaFile