On Thu, Feb 28, 2002 at 10:17:58AM +0900, Jim Weirich wrote:
> Then implementing an output stream could be as simple as implementing
> write and mixing in OutputShell (or whatever) that implements all the
> other methods in terms of write.  Or writing read and mixing in
> InputShell to get an input stream.

I had to put together an input stream on astring in an hour.  Your
OutputShell works well, but I did not write a mirror InputShell
because it would have had to rely on reading one byte at a time.  

Now, I doubt that reading one byte at a time from a string, until a
separator is met, to perform a gets, is the most efficient way.  So I
rewrite most methods but inside the StringIO class, not as a mixin
method, taking advantage of regexps and the likes.

Personally I would have loved the chance of just writing a couple of
specific methods in the final classes and then mix in an InputShell,
so if anyone has a better solution in mind, my eyes are wide open...

(I'd post the StringIO but it's 250+ lines long with tests.)

Massimiliano