Skip to main content

Object serialisation in Squawk

1 reply [Last post]
fraybentos
Offline
Joined: 2007-11-16
Points: 0

Hi,

Is it possible to serialise objects in Squawk? I'm writing a communication protocol for SPOTs and it would be great if I could do send(Object) rather than require clients to serialise/deserialise objects to byte arrays or introduce an interface similar to Serializable that all objects must implement.

Thanks,
Robert

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
derek_white
Offline
Joined: 2006-09-08
Points: 0

It may be plausible to reuse the mechanism used for Isolate serialization for this purpose, but with the same restrictions: both the sender and receiver must have the same versions of the suites loaded.

To see how to implement this, look at Isolate.save() and Isolate.load() in:
http://fisheye4.atlassian.com/browse/squawk/trunk/cldc/src/com/sun/squaw...

In save() you'll see that it calls "VM.copyObjectGraph(this)", where this (the isolate) is the root of the object graph to copy. You would use a different root.

You may not want to hear this :-), but it would be pretty simple to hack this in, and you are in a better position to test it out.

If you'd like the team to implement it you can add a feature request.