Streams and streaming are programming buzzwords that sound more ominous than they really are. We won't try to provide an all-encompassing description of streams, but we'll give you a quick overview. Simply put, streaming is a mechanism that lets you read data, write data, and move around within the data. When we talk about streaming, we mean general input/output operations and not specifically file I/O. Put another way, streaming is about more than just disk files. Certainly, disk files are one type of stream--other types include memory streams (reading and writing data in memory), string streams (for manipulating string data), and console streams (reading and writing to a console window).
Perhaps one of the most important aspects of the streaming mechanism is the concept of the stream position. The stream position is a numerical value that indicates where the next bits of data will be read from (in the case of an input stream) or written to (in the case of an output stream). When you initially open a stream, the stream position is 0. If you read 10 bytes of data, then the stream position advances to 10. If you then read an additional 20 bytes of data, the stream position advances by 20 to contain the value 30. A similar update process happens when you write to a stream. Although the stream position is automatically updated, streaming classes still allow you to ask for the current stream position or to change the current stream position, thereby giving you full control over the contents of the stream.
Naturally, streaming classes have methods that let you read and write data. This is a basic need, and no streaming class would be complete without some way of accessing the data.