Our examples have used a mechanism extensively, even though we haven’t discussed it yet. The Stream class provides a framework for a number of data structures, including input and output functionality, queues, and endless sources of dynamically-generated data. A Smalltalk stream is quite similar to the UNIX streams you’ve used from C. A stream provides a sequential view to an underlying resource; as you read or write elements, the stream position advances until you finally reach the end of the underlying medium. Most streams also allow you to set the current position, providing random access to the medium.
|• The output stream:||Which, even though you maybe didn’t know it, we’ve used all the time|
|• Your own stream:||Which, instead, is something new|
|• Files:||Which are streams too|
|• Dynamic Strings:||A useful application of Streams|