Skip to content

Stream-based IO

关于stream,参见工程discrete的Relation-structure-computation\Model\Stream章节。

Stream抽象了数据的流动(流出、流入),stream模型可以抽象 input/output device,它能够抽象file、network device、custom adaptor device,所以使用stream模型构建的程序,允许我们实现使用抽象的stream来完成对多种device的IO。这个思想就是abstraction思想。

stream模型基本上统治了IO领域:

IO即输入、输出,就是典型的可以使用stream来进行描述的。

wikipedia Stream (computing) # Examples

2) On Unix and related systems based on the C language, a stream is a source or sink of data, usually individual bytes or characters. Streams are an abstraction used when reading or writing files, or communicating over network sockets. The standard streams are three streams made available to all programs.

3) I/O devices can be interpreted as streams, as they produce or consume potentially unlimited data over time.

wikipedia C file input/output

C++ IO library

参见工程programming-language的C-family-language\C++\Library\Standard-library\IO-library章节。