Files
narya/src/java/com/threerings/presents/io/StringFieldMarshaller.java
T
Michael Bayne 6a1de87f2a Further wired up the client side of the distributed object system. Removed
the facilities for fetching (without subscribing to) an object. This is
done extremely rarely and the user might as well just subscribe and
immediately unsubscribe because the dichotomy between fetching and
subscribing just served to overly complicate the internals for no good
reason.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@30 542714f4-19e9-0310-aa3c-eee0fc999fb1
2001-06-09 23:39:04 +00:00

35 lines
956 B
Java

//
// $Id: StringFieldMarshaller.java,v 1.3 2001/06/09 23:39:04 mdb Exp $
package com.threerings.cocktail.cher.dobj.net;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Field;
import com.threerings.cocktail.cher.dobj.DObject;
public class StringFieldMarshaller implements FieldMarshaller
{
/** This is the sort of field that we marshall. */
public String prototype;
public void writeTo (DataOutputStream out, Field field, DObject dobj)
throws IOException, IllegalAccessException
{
String value = (String)field.get(dobj);
// we convert null strings to empty strings
if (value == null) {
value = "";
}
out.writeUTF(value);
}
public void readFrom (DataInputStream in, Field field, DObject dobj)
throws IOException, IllegalAccessException
{
field.set(dobj, in.readUTF());
}
}