This module provides non-random access memory streams. A new read memory stream can be created via the predicate memory_read/3. A new write memory stream can be created via the predicate memory_write/2. The content of write memory stream can be retrieved via the predicate memory_get/2.
?- memory_write(, S), write(S, foo), memory_get(S, atom(A)).
S = 0r1479d830,
A = foo
?- memory_read(atom('foo.\n'), , S), read(S, T).
S = 0r28100c13,
T = foo
The current implementation is limited in that the streams cannot be created with the reposition property. It is therefore not possibly to use the methods set_stream_position/2 or set_stream_length/2. Otherwise all the byte, char, term and stream operations can be applied as if they were file or web streams.
The following memory predicates are provided: