Binary I/O of (nearly) arbitrary data objects.
List of Import References :
See BOOL
See Char
See Com
See DENOTATION
See File
See Int
See Nat
See Option
See Seq
See Stream
See String
See Void
SIGNATURE BinStream[data]
$Date: 2010-09-30 18:24:17 +0200 (Do, 30. Sep 2010) $ ($Revision: 616 $)
SORT data IMPORT Void ONLY void String ONLY string Stream ONLY input output Com[void] ONLY com Com[data] ONLY com Com[input] ONLY com Com[output] ONLY com
Strong typing is violated by functions from this structure. The user is responsible to perform type checks. Reading and writing functions have an additional tag argument, which may be used by the user for type checks.
A tag mismatch error has the format
"binary IO tag mismatches, found '%%', expected '&&'"
.
%%
is the tag found in the file,
&&
is the tag given in the call of read,
both contain also an internal tag.
Written objects must not contain functions, but this is not guaranteed to be checked by implementations.
Open stream for reading in binary mode
FUN openBin : denotation -> com[input]
Open stream for writing in binary mode
createBin : denotation -> com[output] appendBin : denotation -> com[output]
write(output, tag, data)
: write data
to
output
, tagging it with tag
.
FUN write : output ** denotation ** data -> com[void]
store(file, tag, data)
: write data
to file named
file
, tagging it with tag
.
FUN store: denotation ** denotation ** data -> com[void]
read(input, tag)
: read data from input
which was
written with the tag
(aborts otherwise)
FUN read : input ** denotation -> com[data]
load(file, tag)
: read data from file named file
which
was written with the tag
(aborts otherwise)
FUN load: denotation ** denotation -> com[data]
next node: Commands,
prev node: BasicIO,
up to node: Subsystem Streams