-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Two useful method comments. Thanks Hannes.
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
CoreUpdates/6882-TwoUsefulComments-HannesHirzel-2024Nov30-18h37m-hjh.001.cs.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! ! | ||
|