New object streaming code is born!

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1605 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-07-23 05:42:34 +00:00
parent 2601ab2321
commit 2330afc3cd
11 changed files with 2203 additions and 0 deletions
@@ -0,0 +1,33 @@
//
// $Id: SimpleStreamableObject.java,v 1.1 2002/07/23 05:42:34 mdb Exp $
package com.threerings.io;
import com.samskivert.util.StringUtil;
/**
* A simple serializable object implements the {@link Streamable}
* interface and provides a default {@link #toString} implementation which
* outputs all public members.
*/
public class SimpleStreamableObject implements Streamable
{
/**
* Generates a string representation of this instance.
*/
public String toString ()
{
StringBuffer buf = new StringBuffer("[");
toString(buf);
return buf.append("]").toString();
}
/**
* Handles the toString-ification of all public members. Derived
* classes can override and include non-public members if desired.
*/
protected void toString (StringBuffer buf)
{
StringUtil.fieldsToString(buf, this);
}
}