|Did you know ...||Search Documentation:|
|library(iostream): Utilities to deal with streams|
This library contains utilities that deal with streams, notably originating from non-built-in sources such as URLs, archives, windows, processes, etc.
The predicate open_any/5
acts as a broker between applications that can process data from
a stream and libraries that can create streams from diverse sources.
Without this predicate, processing data inevitally follows the pattern
below. As call_some_open_variation can be anything, this blocks
us from writing predicates such as
load_xml(From, DOM) that
can operate on arbitrary input sources.
setup_call_cleanup( call_some_open_variation(Spec, In), process(In), close(In)).
library(uri)to be installed.
The typical usage scenario is given in the code below, where <process> processes the input.
setup_call_cleanup( open_any(Spec, read, In, Close, Options), <process>(In), Close).
Currently, the following libraries extend this predicate:
|Close||is unified to a goal that must be
called to undo the side-effects of the action, e.g., typically the term |
|Options0||are the options passed to open_any/5|
|Options||are passed to the post processing filters that may be installed by open_any/5.|