next up previous contents
Next: Basic Stream Variants Up: Streams and Iterators Previous: Streams and Iterators   Contents

Basic Protocol

Streams respond to a number of common messages. However, many of these only work on some of the stream types, usually according to good sense:

next
reads and answers the next element in the stream. This causes the stream reader to advance one element.
peek
reads and answers the next element in the stream. This does not advance the stream reader.
next:
draws the next n number of elements from the stream and delivers them in a Sequence of the appropriate type.
next:putInto:
reads the next N elements into the given Sequence starting from index 0.
next:putInto:startingAt:
reads the N elements into the given Sequence starting from the given index.
nextPutInto:
reads into the given Sequence the number of elements which will fit into it.
nextPut:
writes the object to the stream.
nextPutAll:
alias stream ; sequence writes all the objects in the Sequence to the stream. The ; selector allows the user to cascade several sequences into the stream as though they were concatenated.
do:
applies a Block to each element of the stream.
flush
synchronizes the total state of the stream with any pending requests made by the user.
isAtEnd
answers whether or not the stream has reached some limit.
upToEnd
collects all the elements of the stream up to its limit into an ExtensibleSequence.
contents
answers a collection of the output of the argument WriteStream.


next up previous contents
Next: Basic Stream Variants Up: Streams and Iterators Previous: Streams and Iterators   Contents
Brian Rice 2004-08-24