Added support for streaming arrays of streamables; extracted the efficient

streamable serialization code from PolyStreamableList and made it
generally available; modified the StreamableArrayList to support
heterogenous lists (because they don't have much more overhead than
homogenous lists now) which allows us to remove PolyStreamableList
entirely.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1140 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2002-03-20 22:58:26 +00:00
parent 357a8e5949
commit 1bf6e6093d
6 changed files with 319 additions and 177 deletions
@@ -1,5 +1,5 @@
//
// $Id: FieldMarshallerRegistry.java,v 1.13 2002/02/07 05:27:07 mdb Exp $
// $Id: FieldMarshallerRegistry.java,v 1.14 2002/03/20 22:58:26 mdb Exp $
package com.threerings.presents.io;
@@ -35,6 +35,9 @@ public class FieldMarshallerRegistry
if (Streamable.class.isAssignableFrom(clazz)) {
marsh = _streamableMarsh;
_registry.put(clazz, marsh);
} else if (STREAMARRAY_CLASS.isAssignableFrom(clazz)) {
marsh = _streamarrayMarsh;
_registry.put(clazz, marsh);
}
}
@@ -75,6 +78,14 @@ public class FieldMarshallerRegistry
protected static FieldMarshaller _streamableMarsh =
new StreamableFieldMarshaller();
/** Used for marshalling arrays of {@link Streamable}. */
protected static FieldMarshaller _streamarrayMarsh =
new StreamableArrayFieldMarshaller();
/** Used to identify streamable array instances. */
protected static final Class STREAMARRAY_CLASS =
(new Streamable[0]).getClass();
static {
// register our field marshallers
registerMarshaller(BooleanFieldMarshaller.class);