diff --git a/core/src/main/java/com/threerings/util/StreamablePoint.java b/core/src/main/java/com/threerings/util/StreamablePoint.java index ddd0fd038..16faae2b7 100644 --- a/core/src/main/java/com/threerings/util/StreamablePoint.java +++ b/core/src/main/java/com/threerings/util/StreamablePoint.java @@ -7,6 +7,10 @@ package com.threerings.util; import java.awt.Point; +import java.io.IOException; + +import com.threerings.io.ObjectInputStream; +import com.threerings.io.ObjectOutputStream; import com.threerings.io.Streamable; /** @@ -31,4 +35,21 @@ public class StreamablePoint extends Point { super(p); } + + /** + * Writes our custom streamable fields. + */ + public void writeObject (ObjectOutputStream out) throws IOException + { + out.writeInt(x); + out.writeInt(y); + } + + /** + * Reads our custom streamable fields. + */ + public void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException + { + setLocation(in.readInt(), in.readInt()); + } } diff --git a/core/src/main/java/com/threerings/util/StreamableRectangle.java b/core/src/main/java/com/threerings/util/StreamableRectangle.java index 2f5d02192..55c42d260 100644 --- a/core/src/main/java/com/threerings/util/StreamableRectangle.java +++ b/core/src/main/java/com/threerings/util/StreamableRectangle.java @@ -7,6 +7,10 @@ package com.threerings.util; import java.awt.Rectangle; +import java.io.IOException; + +import com.threerings.io.ObjectInputStream; +import com.threerings.io.ObjectOutputStream; import com.threerings.io.Streamable; /** @@ -37,4 +41,23 @@ public class StreamableRectangle extends Rectangle public StreamableRectangle () { } + + /** + * Writes our custom streamable fields. + */ + public void writeObject (ObjectOutputStream out) throws IOException + { + out.writeInt(x); + out.writeInt(y); + out.writeInt(width); + out.writeInt(height); + } + + /** + * Reads our custom streamable fields. + */ + public void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException + { + setBounds(in.readInt(), in.readInt(), in.readInt(), in.readInt()); + } }