Modified field marshalling code to work on any object rather than being

DObject specific (because it didn't need to be).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@911 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-02-01 23:26:49 +00:00
parent d925c5d1b4
commit ef9e0bc53f
15 changed files with 131 additions and 124 deletions
@@ -1,5 +1,5 @@
//
// $Id: FloatFieldMarshaller.java,v 1.4 2001/10/11 04:07:52 mdb Exp $
// $Id: FloatFieldMarshaller.java,v 1.5 2002/02/01 23:26:49 mdb Exp $
package com.threerings.presents.dobj.io;
@@ -8,22 +8,20 @@ import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Field;
import com.threerings.presents.dobj.DObject;
public class FloatFieldMarshaller implements FieldMarshaller
{
/** This is the sort of field that we marshall. */
public float prototype;
public void writeTo (DataOutputStream out, Field field, DObject dobj)
public void writeTo (DataOutputStream out, Field field, Object obj)
throws IOException, IllegalAccessException
{
out.writeFloat(field.getFloat(dobj));
out.writeFloat(field.getFloat(obj));
}
public void readFrom (DataInputStream in, Field field, DObject dobj)
public void readFrom (DataInputStream in, Field field, Object obj)
throws IOException, IllegalAccessException
{
field.setFloat(dobj, in.readFloat());
field.setFloat(obj, in.readFloat());
}
}