Charles Oliver Nutter wrote:
Thoughts? More ideas?

More ideas!

A different approach, less brute-force, but requires control over the deserialization process (perhaps that's not too much to ask?)...

RubyObject.java:

    public void readExternal(ObjectInput in) throws IOException,
            ClassNotFoundException {
        RubyObjectInputStream rois = (RubyObjectInputStream)in;

        this.flags = in.readInt();
        this.instanceVariables = (Map)in.readObject();
        // FIXME: is it safe to assume this must always be a RubyClass?
        this.metaClass =
            (RubyClass)rois.getRuntime().getClassFromPath(in.readUTF());
    }

RubyObjectInputStream.java:

public class RubyObjectInputStream extends ObjectInputStream {
    private Ruby runtime;

    protected RubyObjectInputStream(Ruby runtime) throws IOException,
            SecurityException {
        super();
        this.runtime = runtime;
    }

    public Ruby getRuntime() {
        return runtime;
    }
}

You could also make runtime settable, and use a single inputstream to read objects into multiple runtimes in sequence.

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to