com.threerings.export
Class Streamer<T>

java.lang.Object
  extended by com.threerings.export.Streamer<T>

public abstract class Streamer<T>
extends Object

Writes objects to and reads objects from a binary stream.


Nested Class Summary
protected static class Streamer.Dummy
          Used to satisfy the type system.
 
Field Summary
protected static HashMap<Class<?>,Streamer> _streamers
          Registered streamers.
 
Constructor Summary
Streamer()
           
 
Method Summary
static Streamer getStreamer(Class<?> clazz)
          Returns the streamer, if any, for the specified class.
abstract  T read(DataInputStream in)
          Reads an object from the stream.
abstract  void write(T value, DataOutputStream out)
          Writes an object to the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_streamers

protected static HashMap<Class<?>,Streamer> _streamers
Registered streamers.

Constructor Detail

Streamer

public Streamer()
Method Detail

getStreamer

public static Streamer getStreamer(Class<?> clazz)
Returns the streamer, if any, for the specified class.


write

public abstract void write(T value,
                           DataOutputStream out)
                    throws IOException
Writes an object to the stream.

Throws:
IOException

read

public abstract T read(DataInputStream in)
                throws IOException,
                       ClassNotFoundException
Reads an object from the stream.

Throws:
IOException
ClassNotFoundException