|
Navigation: Programming Cookbook > Binary Filing Objects > Retrieving objects |
![]() ![]()
|
This is, as you might expect, just the reverse of storing. You need to create a binary-aware stream on the data and attach it to an STBInFiler. Then each send of the #next method will recreate and answer the corresponding object that was #nextPut: into the data stream by the STBOutFiler.
S := FileStream read: 'Test.STB' text: false.
STB := STBInFiler on: S.
X := STB next.
Y := STB next.
Z := STB next.
S close.
To retrieve the objects from a ByteArray rather than a file, simply substitute a ReadStream on the byte array instead of a file stream.