From 0be130a3834d1bee03aa80730e29351f73cedb58 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 13 Nov 2025 16:50:55 -0800 Subject: [PATCH] Handle streaming of data manually. We can no longer reflect on java.awt classes and fiddle with their internals. --- .../com/threerings/util/StreamablePoint.java | 21 +++++++++++++++++ .../threerings/util/StreamableRectangle.java | 23 +++++++++++++++++++ 2 files changed, 44 insertions(+) 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()); + } }