Skip to content

Commit

Permalink
Two useful method comments. Thanks Hannes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jvuletich committed Dec 1, 2024
1 parent 2de67e8 commit 3a94a1f
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'From Cuis7.1 [latest update: #6858] on 30 November 2024 at 6:39:45 pm'!

!ReferenceStream class methodsFor: 'as yet unclassified' stamp: 'hjh 11/30/2024 18:38:35'!
dumpOnFile: aFileEntry object: anObject
"Warning: If the file given by aFileEntry exists, it will be overwritten."

aFileEntry forceWriteStreamDo: [ :stream |
(self on: stream) nextPut: anObject ].! !

!ReferenceStream class methodsFor: 'as yet unclassified' stamp: 'hjh 11/30/2024 18:37:58'!
restoreFromFile: aFileEntry
"
Note about importing String objects from Squeak:
To make sure Strings can be moved from Squeak use
aString utf8Encoded
to convert the strings to ByteArrays in Squeak before you export the object collection.
In Cuis you need to do then
UnicodeString fromUtf8Bytes: aByteArray
to get them back.
"
| answer |
aFileEntry readStreamDo: [ :stream |
answer := (self on: stream) next ].
^answer! !

0 comments on commit 3a94a1f

Please sign in to comment.