Handle streaming of data manually.
We can no longer reflect on java.awt classes and fiddle with their internals.
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user