com.threerings.io
Class BasicStreamers.CollectionStreamer

java.lang.Object
  extended by com.threerings.io.Streamer
      extended by com.threerings.io.BasicStreamers.BasicStreamer
          extended by com.threerings.io.BasicStreamers.CollectionStreamer
Direct Known Subclasses:
BasicStreamers.ListStreamer, BasicStreamers.SetStreamer
Enclosing class:
BasicStreamers

protected abstract static class BasicStreamers.CollectionStreamer
extends BasicStreamers.BasicStreamer

A building-block class for streaming Collections.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.threerings.io.Streamer
Streamer.ArrayStreamer, Streamer.ByteEnumStreamer, Streamer.ByteOrdEnumStreamer, Streamer.ClassStreamer, Streamer.CustomClassStreamer, Streamer.EnumPolicy, Streamer.EnumStreamer, Streamer.FinalArrayStreamer, Streamer.IntOrdEnumStreamer, Streamer.NameEnumStreamer, Streamer.OrdEnumStreamer, Streamer.ShortOrdEnumStreamer
 
Field Summary
static List<Class<?>> SPECIFICITY_ORDER
          The ordering for Collection/Iterable classes, most to least specific.
 
Fields inherited from class com.threerings.io.Streamer
_streamers, ENUM_POLICY, FIELD_NAME_ORDER, IS_STREAMABLE, IS_STREAMCLOSURE, READER_ARGS, READER_METHOD_NAME, SORT_FIELDS, WRITER_ARGS, WRITER_METHOD_NAME
 
Constructor Summary
protected BasicStreamers.CollectionStreamer()
           
 
Method Summary
protected abstract  Collection<Object> createCollection(int size)
          Called to create the collection being read.
 Object createObject(ObjectInputStream in)
          Creates a blank object that can subsequently be read by this streamer.
 void writeObject(Object object, ObjectOutputStream out, boolean useWriter)
          Writes the supplied object to the specified stream.
 
Methods inherited from class com.threerings.io.BasicStreamers.BasicStreamer
readObject
 
Methods inherited from class com.threerings.io.Streamer
create, getCollectionClass, getStreamer, getStreamerClass, isStreamable, maybeInit, toString, toStringHelper
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SPECIFICITY_ORDER

public static final List<Class<?>> SPECIFICITY_ORDER
The ordering for Collection/Iterable classes, most to least specific.

Constructor Detail

BasicStreamers.CollectionStreamer

protected BasicStreamers.CollectionStreamer()
Method Detail

createObject

public Object createObject(ObjectInputStream in)
                    throws IOException,
                           ClassNotFoundException
Description copied from class: Streamer
Creates a blank object that can subsequently be read by this streamer. Data may be read from the input stream as a result of this method (in the case of arrays, the length of the array must be read before creating the array).

Specified by:
createObject in class Streamer
Throws:
IOException
ClassNotFoundException

writeObject

public void writeObject(Object object,
                        ObjectOutputStream out,
                        boolean useWriter)
                 throws IOException
Description copied from class: Streamer
Writes the supplied object to the specified stream.

Specified by:
writeObject in class Streamer
Parameters:
object - the instance to be written to the stream.
out - the stream to which to write the instance.
useWriter - whether or not to use the custom writeObject if one exists.
Throws:
IOException

createCollection

protected abstract Collection<Object> createCollection(int size)
Called to create the collection being read.

Parameters:
size - the exact size of the collection.