alice
library
manual.

Alice Project

The BinIO structure


________ Synopsis ____________________________________________________

    signature BIN_IO
    structure BinIO : BIN_IO
  

The Standard ML Basis' BinIO structure.

See also: TextIO, IMPERATIVE_IO


________ Import ______________________________________________________

Imported implicitly.


________ Interface ___________________________________________________

    signature BIN_IO =
    sig
	structure StreamIO : STREAM_IO where type vector = Word8Vector.vector
				         and type elem   = Word8.word
				         and type pos    = Position.int

	type vector = StreamIO.vector
	type elem   = StreamIO.elem

	type instream
	type outstream

	val openIn :        string -> instream
	val input :         instream -> vector
	val input1 :        instream -> elem option
	val inputN :        instream * int -> vector
	val inputAll :      instream -> vector
	val seekIn :        instream * StreamIO.pos -> unit
	val canInput :      instream * int -> int option
	val lookahead :     instream -> elem option
	val closeIn :       instream -> unit
	val endOfStream :   instream -> bool
	val mkInstream :    StreamIO.instream -> instream
	val getInstream :   instream -> StreamIO.instream
	val setInstream :   instream * StreamIO.instream -> unit

	val openOut :       string -> outstream
	val openAppend :    string -> outstream
	val openOverwrite : string -> outstream
	val output :        outstream * vector -> unit
	val output1 :       outstream * elem -> unit
	val flushOut :      outstream -> unit
	val seekOut :       outstream * StreamIO.pos -> unit
	val closeOut :      outstream -> unit
	val mkOutstream :   StreamIO.outstream -> outstream
	val getOutstream :  outstream -> StreamIO.outstream
	val setOutstream :  outstream * StreamIO.outstream -> unit
	val getPosOut :     outstream -> StreamIO.out_pos
	val setPosOut :     outstream * StreamIO.out_pos -> unit
    end
  

________ Description _________________________________________________

Items not described here are like in the Standard ML Basis' BinIO structure.

openOverwrite name

Opens the file name for writing. Like openOut, except that the file is not truncated.

seekIn (is, pos)

Sets the absolute position of the stream is to pos by applying setPos on the underlying reader. Raises IO.RandomAccessNotSupported if the reader does not support positioning. Note that this function extracts the reader from the underlying functional stream, which truncates the stream. The imperative stream is then redirected to a new functional stream reconstructed from the reader.

seekOut (os, pos)

Sets the absolute position of the stream os to pos by applying setPos on the underlying writer. Raises IO.RandomAccessNotSupported if the writer does not support positioning. Note that this function extracts the writer from the underlying functional stream, which terminates the stream. The imperative stream is then redirected to a new functional stream reconstructed from the writer.



last modified 2007/Mar/30 17:10