From: nobu.nokada@... Date: 2002-05-13T11:19:41+09:00 Subject: Re: stringIO extension? Hi, At Mon, 13 May 2002 07:04:10 +0900, Thomas Sondergaard wrote: > 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. I thought similar thing. > Basically the scheme employed by streambuf in the Standard C++ Library. > > How hard would it be to extend stringIO with these facilities? There're still points to be discussed. underflow()/overflow() can change the entire buffer itself? If so, how about `offset'? > 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 Considerable. To implement is easiest in programming but to design is difficult. -- Nobu Nakada