[fix] TextStream
Torge.Husfeldt at gmx.de
Torge.Husfeldt at gmx.de
Mon Jan 6 09:37:34 UTC 2003
Hi,
I always find it nice to use the #streamContents: method instead, since
most of
the time i'm not interested in the stream itself. So this selector is
more intention-
revealing.
Try:
String streamContents:[strStr |
strStr nextPut: Character cr.
"usw."]
or:
Text streamContents:[strStr |
strStr nextPut: Character cr.
"usw."]
or even:
Array streamContents:[strStr |
strStr nextPut: Character cr.
"usw."]
but not:
OrderedCollection streamContents:[strStr |
strStr nextPut: Character cr.
"usw."]
unless you filed in the attached cs that works around an annoyance with
WriteStream>>pastEndPut: not being adequate for OrderedCollection as a
model.
HTH,
Torge
Niko Schwarz <niko.schwarz at gmx.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Am Sonntag, 5. Januar 2003 19:46 schrieb Boris Gaertner:
>
> > Nick,
> >
> > TextStreams are designed to stream not over an instance of String, but
> > over an instance of Text.
>
> And I was so proud...
>
> > An instance of Text has two components:
> > a string and a run array that keeps style attributes for every single
> > character of the string.
>
> Arg... I should have known.. I had been already seeking for a StringWriter,
> but when it was so easily "fixable", I messed up..
>
> > Here is an example that shows what you can do with
> > TextStreams: (execute it in a workspace)
>
> Nice. But I only wanted to assemble some xml...
>
> > Greetings, Boris
>
> Thank you for your help, sorry for screwing up so much :-)
>
> regards,
>
> nick
>
> - --
> Time flies like an arrow, but fruit flies like a banana.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.1 (GNU/Linux)
>
> iD8DBQE+GIbM3P3nmXTVnC8RAmyEAKDms1lAdcOEe03tk7CIoICFFyS6kgCcC1ah
> Bx2idBBXp7+fQzBAzhWJl8Q=
> =W4lp
> -----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: streamContentsFix-th.1.cs.gz
Type: application/octet-stream
Size: 306 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030106/69287a87/streamContentsFix-th.1.cs.obj
More information about the Squeak-dev
mailing list
|