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

Basic Instantiation

There are a number of ways to create Streams, and a large number of implementations, so some methods exist to simplify the process of making a new one:

newOn:
creates a new Stream of the same type as the first argument, targeting it to the second as a source. This should not be overridden. Instead, the re-targeting method on: is overridden.
newTo:
creates a new WriteStream of the appropriate type on the specified target. This should be overridden for derived types, and the first argument should apply to the generic Stream type to allow any instance to know this protocol.
newFrom:
creates a new ReadStream of the appropriate type on the specified target. This should be overridden for derived types, and the first argument should apply to the generic Stream type to allow any instance to know this protocol.
buffered
creates and returns a new BufferStream whose type corresponds to the argument and wraps the argument Stream.
readBuffered
creates and returns a new ReadBufferStream which wraps the argument Stream.
writeBuffered
creates and returns a new WriteBufferStream which wraps the argument Stream.
echoTo:
creates and returns a new EchoStream which wraps the first argument Stream and echoes to the second.
echo
creates and returns a new EchoStream to the Console.
>>
performs a looping iterative transfer of all elements of the first stream to the second. The second argument may be any WriteStream, or a StreamProcessor, or a single-argument Method in which case it has the same semantics as collect:. For targets to ExternalResources, it will perform a buffered transfer. This method always returns the target stream so that the results may be further processed.


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