[squeak-dev] Upgrading serialized Morphs to new Paragraph stuff
Bob Arning
arning315 at comcast.net
Thu Oct 3 18:01:44 UTC 2013
Since Chris has not responded with the particular serialization method
employed, there's not much real advice to be given. The particular
method may well have a way to deal with this.
Cheers,
Bob
On 10/3/13 1:48 PM, Nicolas Cellier wrote:
> We could as well restore an empty MultiNewParagraph in *45Deprecated,
> then let you becomeForward: each MultiNewParagraph into a NewParagraph
>
>
> 2013/10/3 Bob Arning <arning315 at comcast.net
> <mailto:arning315 at comcast.net>>
>
> That's one way. Another is 'save morph in file' from the metamenu.
> Question is which Chris used.
>
> On 10/3/13 6:33 AM, Edgar De Cleene wrote:
>> On 10/3/13 6:55 AM, "Bob Arning"<arning315 at comcast.net> <mailto:arning315 at comcast.net> wrote:
>>
>>> One questions is: how were they serialized?
>>>
>>> Cheers,
>>> Bob
>>>
>> Here you have how to exchange serialized objects between Squeak, Pharo and
>> Cuis.
>>
>> For Pharo 2.0 you need fileIn ReferenceStream logic first.
>> Drag any .obj into World and you got a Inspector of on it.
>>
>> !Object methodsFor: 'objects from disk' stamp: 'edc 9/6/2008 19:40'!
>> fileOutCompressed
>>
>> | unzipped zipped buffer aFileName |
>> aFileName := self class name asFileName. "do better?"
>> aFileName := UIManager default
>> request: 'File name?' translated initialAnswer: aFileName.
>> aFileName size == 0 ifTrue: [^ Beeper beep].
>> Cursor write
>> showWhile: [unzipped := RWBinaryOrTextStream on: ''.
>> unzipped fileOutClass: nil andObject: self.
>> unzipped reset.
>> zipped := FileDirectory default newFileNamed: aFileName , 'obz'.
>> zipped binary.
>> zipped := GZipWriteStream on: zipped.
>> buffer := ByteArray new: 50000.
>> 'Compressing ' , self name
>> displayProgressAt: Sensor cursorPoint
>> from: 0
>> to: unzipped size
>> during: [:bar |
>> [unzipped atEnd]
>> whileFalse: [bar value: unzipped position.
>> zipped
>> nextPutAll: (unzipped nextInto: buffer)].
>> zipped close.
>> unzipped close]]! !
>>
>> !Object methodsFor: 'objects from disk' stamp: 'edc 6/20/2011 11:41'!
>> saveOnFileNamed: aString
>> "Ask the user for a filename and save myself on a
>> ReferenceStream file. Writes out the version and class structure.
>> The file is fileIn-able. UniClasses will be filed out.
>> This save objects as .obj"
>> | aFileName fileStream |
>> aString isEmpty
>> ifTrue: [^ self error: 'name is missing'].
>> aFileName := aString , '.obj'.
>> fileStream := ReferenceStream fileNamed: aFileName .
>> fileStream nextPut: self.
>> fileStream close.
>> ! !
>>
>>
>> !Object class methodsFor: 'objects from disk' stamp: 'edc 6/20/2011 12:16'!
>> readAndInspect: inputStream
>> | o rr |
>> rr _ ReferenceStream on: inputStream.
>> o _ rr next.
>> rr close.
>> o inspect! !
>>
>> !Object class methodsFor: '*services-extras' stamp: 'edc 2/14/2008 08:24'!
>> fileReaderServicesForFile: fullName suffix: suffix
>> | services |
>> services _ OrderedCollection new.
>>
>> (fullName asLowercase endsWith: '.obj')
>> ifTrue: [ services add: self serviceLoadObject ].
>> ^services! !
>>
>> !Object class methodsFor: '*services-extras' stamp: 'edc 7/27/2008 08:11'!
>> readCompressedObject: aFileStream
>>
>> self readAndInspect: (MultiByteBinaryOrTextStream with: (GZipReadStream
>> on: aFileStream) upToEnd) reset! !
>>
>> !Object class methodsFor: '*services-extras' stamp: 'edc 7/27/2008 07:40'!
>> serviceCompressedObject
>> "Answer a service for opening a saved Object"
>> ^ (SimpleServiceEntry
>> provider: Object
>> label: 'gz saved Object'
>> selector: #readCompressedObject:
>> description: 'open a gz Object'
>> buttonLabel: 'object')
>> argumentGetter: [:fileList |
>>
>> fileList readOnlyStream]! !
>>
>> !Object class methodsFor: '*services-extras' stamp: 'edc 2/14/2008 08:26'!
>> serviceLoadObject
>> "Answer a service for opening a saved Object"
>>
>> ^ (SimpleServiceEntry
>> provider: self
>> label: 'saved Object'
>> selector: #readAndInspect:
>> description: 'open a Object'
>> buttonLabel: 'object')
>> argumentGetter: [:fileList | fileList readOnlyStream]! !
>>
>>
>>
>>
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20131003/b27e18e3/attachment.htm
More information about the Squeak-dev
mailing list
|