com.threerings.io
Class Streamer.CustomClassStreamer

java.lang.Object
  extended by com.threerings.io.Streamer
      extended by com.threerings.io.Streamer.ClassStreamer
          extended by com.threerings.io.Streamer.CustomClassStreamer
Enclosing class:
Streamer

protected static class Streamer.CustomClassStreamer
extends Streamer.ClassStreamer

Extends basic class streaming with support for customized streaming.


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
protected  Method _reader
          A reference to the readObject method if one is defined by our target.
protected  Method _writer
          A reference to the writeObject method if one is defined by our target.
 
Fields inherited from class com.threerings.io.Streamer.ClassStreamer
_ctor, _ctorArgs, _fields, _marshallers, _target
 
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 Streamer.CustomClassStreamer(Class<?> target, Method reader, Method writer)
          Constructor.
 
Method Summary
protected  FieldMarshaller[] createMarshallers()
          Creates and returns the reading and writing marshallers.
 void readObject(Object object, ObjectInputStream in, boolean useReader)
          Reads and populates the fields of the supplied object from the specified stream.
protected  Objects.ToStringHelper toStringHelper()
          Overrideable to add more information to this class' toString() representation.
 void writeObject(Object object, ObjectOutputStream out, boolean useWriter)
          Writes the supplied object to the specified stream.
 
Methods inherited from class com.threerings.io.Streamer.ClassStreamer
createObject, initConstructor
 
Methods inherited from class com.threerings.io.Streamer
create, getCollectionClass, getStreamer, getStreamerClass, isStreamable, maybeInit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_reader

protected Method _reader
A reference to the readObject method if one is defined by our target.


_writer

protected Method _writer
A reference to the writeObject method if one is defined by our target.

Constructor Detail

Streamer.CustomClassStreamer

protected Streamer.CustomClassStreamer(Class<?> target,
                                       Method reader,
                                       Method writer)
Constructor.

Method Detail

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.

Overrides:
writeObject in class Streamer.ClassStreamer
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

readObject

public void readObject(Object object,
                       ObjectInputStream in,
                       boolean useReader)
                throws IOException,
                       ClassNotFoundException
Description copied from class: Streamer
Reads and populates the fields of the supplied object from the specified stream.

Overrides:
readObject in class Streamer.ClassStreamer
Parameters:
object - the instance to be read from the stream.
in - the stream from which to read the instance.
useReader - whether or not to use the custom readObject if one exists.
Throws:
IOException
ClassNotFoundException

createMarshallers

protected FieldMarshaller[] createMarshallers()
Description copied from class: Streamer.ClassStreamer
Creates and returns the reading and writing marshallers.

Overrides:
createMarshallers in class Streamer.ClassStreamer

toStringHelper

protected Objects.ToStringHelper toStringHelper()
Description copied from class: Streamer
Overrideable to add more information to this class' toString() representation.

Overrides:
toStringHelper in class Streamer.ClassStreamer