[newbie] Object>>asByteArray???

Ned Konz ned at bike-nomad.com
Thu May 29 03:45:56 UTC 2003


Michael van der Gulik wrote:
> Hi all.
> 
> I want to turn an Object (which doesn't contain references other than a 
> couple of strings, integers and so forth) into a ByteArray.
> 
> Is there a trivial way of doing this? I've been looking through the 
> code. Magma has it's own rather scary looking set of classes for doing 
> this. ImageSegments is one way of doing this, I guess. Object asString 
> isn't quite what I want.
> 
> I just want something like
> "(ByteArrayStream new: 1024) nextPut: myObject"
> or something like that. Is there an easy way to do this?

Look at ReferenceStream.

There's also storeOn:, which might work for you.





More information about the Squeak-dev mailing list