When creating streams, one should procede as follows:
connect_to
feature of filter streams;Taken together, interconnected filters and terminal make a filtered stream; one reads and/or writes from one side of the "pipe", while the terminal reads/writes at the other side.
First of all, input and output streams have symmetrical hierarchies. They also have a common ancestor (Note: this ancestor is currently inserted, not inherited).
Those classes are split in two hierarchies: on the one hand, filters, on the other hand, terminals.
Filtered streams are in fact a double-linked objects: each filter points to an underlying stream (be it another filter or a terminal) while each stream points to a filter. The "stream-to-filter" back-link is used for assertions, to ensure one does not bypass filters.
Filters are stuck in front of a stream (be it another filter or a terminal). They provide extra functionality: compression, buffers, and so on.
Note: you cannot directly use streams that are connected to a filter; use that filter instead.
Terminals are back-end bytes readers and/or writers. There are many
such terminals: files, sockets, strings and so on. There are even the
equivalent of the good ol' Unix /dev/null
device, which
eats bytes and provides zeroes.
There are three kinds of terminal streams: TERMINAL_INPUT_STREAM
, TERMINAL_OUTPUT_STREAM
,
and TERMINAL_INPUT_OUTPUT_STREAM
Note that there are only terminal input-output streams. Filters do not have this notion: you use either an input or an output stream, even if the underlying resource has input-output capabilities.
The class STANDARD_STREAMS
provides access to the standard streams. GENERAL
provides an
access to a STANDARD_STREAMS
once object, along with shortcuts to
the most used features: the standard streams std_input
,
std_output
, std_error
, and the most used
io
which is but a centralized access to the former two.
STANDARD_STREAMS
provides
features to dynamically change standard streams. It allows to:
FILE_TOOLS
for some basic
file management (rename, delete, access to size, date, permissions...);DIRECTORY
for directory
exploration (see also the more low-level BASIC_DIRECTORY
.