[Help] How can I fileout to an internal stream?

Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Fri Sep 7 09:38:38 UTC 2007




El 9/6/07 8:53 PM, "Jerome Peace" <peace_the_dreamer at yahoo.com> escribió:

> How can I fileout to an internal stream?
> 
> 
> Ok. I¹ve run into a problem in 3dot10.
> When writing out text in a Sans Vera font it reads
> back in Accuny. That is, save the text morph and read
> it back.
> 
> Now I¹d like to write a test for this w/o actually
> having to write a file to disk.
> 
> All I need is to put an object into a stream encoded
> as if for saving and then read it back decoded from
> the same stream.
> 
> What¹s the best way to do that? I¹ve chased methods
> till my eyes hurt and would like help, hopefully from
> someone who already knows the answer.
> 
> Yours in curiosity and service, --Jerome Peace

On the inspector.
| rw |
rw := RWBinaryOrTextStream with: ''.
rw fileOutClass: nil andObject: self .
rw inspect

On this new inspector

| morphOrList |
self reset .

morphOrList _ self fileInObjectAndCode.
    (morphOrList isKindOf: SqueakPage) ifTrue: [morphOrList _ morphOrList
contentsMorph].
    Smalltalk isMorphic
        ifTrue: [ActiveWorld addMorphsAndModel: morphOrList]
        ifFalse:
            [morphOrList isMorph ifFalse: [self inform: 'Can only load a
single morph
into an mvc project via this mechanism.'].
            morphOrList openInWorld]

Now you could see how and optimize.

By the way, is very odd see selected Text is changing fonts.

Saludos amigo !

Edgar





More information about the Squeak-dev mailing list