Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
ReferenceStream example
Last updated at 12:59 pm UTC on 11 October 2017

Read file with objects


 readTrainingsSamples
    "read the class var TrainingsSamples from a file using ReferenceStreams "
    | rr |
    rr := ReferenceStream fileNamed: 'trainingssamples.obj'.
    TrainingsSamplesFehlerkategorien  trainingsSamples:  rr next.
    rr close.
    rr := nil

Write file with objects


 writeTrainingsSamples
    "write the class var TrainingsSamples to a file using ReferenceStreams"

    | rr |
    rr := ReferenceStream fileNamed: 'trainingssamples.obj'.
    rr nextPut: TrainingsSamplesFehlerkategorien  trainingsSamples .
    rr close.
    rr := nil



Example by
Herbert König
Wed, Jan 11, 2017 at 8:37 PM
Reply-To: The general-purpose Squeak developers list
To: squeak-dev@lists.squeakfoundation.org



Note: For ReferenceStream and SmartReferenceStream - the format is binary and not necessary compatible over image versions.
If you use JSON you have a source code format.