Handle streaming of data manually.

We can no longer reflect on java.awt classes and fiddle with their internals.
This commit is contained in:
Michael Bayne
2025-11-13 16:50:55 -08:00
parent 685468fd70
commit 0be130a383
2 changed files with 44 additions and 0 deletions
@@ -7,6 +7,10 @@ package com.threerings.util;
import java.awt.Point; import java.awt.Point;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable; import com.threerings.io.Streamable;
/** /**
@@ -31,4 +35,21 @@ public class StreamablePoint extends Point
{ {
super(p); 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());
}
} }
@@ -7,6 +7,10 @@ package com.threerings.util;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.io.IOException;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.Streamable; import com.threerings.io.Streamable;
/** /**
@@ -37,4 +41,23 @@ public class StreamableRectangle extends Rectangle
public StreamableRectangle () 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());
}
} }