From: Thomas Sondergaard Date: 2002-05-13T07:04:10+09:00 Subject: stringIO extension? Hi, I just skimmed through the latest messages in ruby-dev using babelfish (the babelfished links on http://www.ruby-lang.org/en/ml.html are broken, by the way) and saw that stringIO is being discussed. I would like to see StringIO being extended a bit to allow more general usage, but I don't speak japanese, so I hope my point will be heard anyway, if I post it here. I would like to see the stringIO class be extended or rewritten, so it can be used to implement a streaming facility for arbitrary data sources/sinks. For input I'd basically like to see stringIO call underflow() when it reaches eof. The default underflow() would do nothing, but a subclass could overwrite it to "refill" the string and then use the string as a buffering space that is refilled in chunks. Similarly I suggest that stringIO for output could be configured with a limit, at which point overflow() would be called. overflow() could then pass the data on to whatever data sink it desires. Basically the scheme employed by streambuf in the Standard C++ Library. How hard would it be to extend stringIO with these facilities? Best regards, Thomas PS! Actually I think it would make sense to implement some sort of AbstractIO and implement stringIO on top of that, instead of using stringIO directly as a facility for implementing other IO classes PPS! If you haven't tried babelfishing in ruby-dev I suggest you give it a go. It is almost impossible to decipher the meaning, but it's a quite amusing read :-)