[squeak-dev] Beginner's question: How to serialize/materialize an object to/from a ByteArray?

Chris Muller asqueaker at gmail.com
Sat Sep 7 17:33:34 UTC 2013


I just noticed 'browse class versions' is still not working with the
new-and-improved SqueakSource prototype because maybe there's a bug
with serializing an object to/from a ByteArray with Squeak?

I had wanted to use MultiByteBinaryOrTextStream to serialize to a
ByteArray, but when I try this:

| ba myObject |
myObject := MethodReference asClassDefinition.
ba :=  ((ReferenceStream on: (MultiByteBinaryOrTextStream on: ByteArray new))
     nextPut: myObject ;
     yourself) contents.
(ReferenceStream on: (MultiByteBinaryOrTextStream on: ba)) next

Produces an error:  'The file did not exist in this directory'.   Huh?
 What file?  What directory?

I've only ever used my own serializer since about 2004, which I think
is much better but obviously for in-image stuff I have to use
ReferenceStream.

Any help would be greatly appreciated.


More information about the Squeak-dev mailing list