A stream concept at the io level is a file (generally a text file)
A stream is an abstract concept for files and io devices which can be read or written, or sometimes both.
I/O devices can be interpreted as streams, as they produce or consume potentially unlimited data over time.
Stream I/O (input/output) refers to the transfer of data either to or from a storage medium. Streams are a mean to manipulate the data that is read or written from and to a file (from byte to characters, object ,…).
For instance, a file content is an ordered collection of bytes and you manipulate this sequence of byte through the creation of a stream that gives you methods to read from and write to and from destinations such as:
Note:
Reading or writing a large amount of data can be resource-intensive. You should perform these tasks asynchronously if your application needs to remain responsive to the user. With synchronous I/O operations, the thread is blocked until the resource-intensive operation has completed. Use asynchronous I/O operations when developing apps to prevent creating the impression that your app has stopped working.
A stream can represent many different kinds of:
that holds, generates, or consumes data.
For instance:
Typically, streams are designed for simple byte input and output but they can supports many different kinds of data including:
Some streams simply pass on data; others manipulate and transform the data.
All streams present the same simple model to programs that use them.
A program uses an input stream to read data sequentially (one item at time) from a source.
A program uses an output stream to write data sequentially (one item at time) to a destination.
See IO - Standard streams (stdin, stdout, stderr)