games.strategy.net.nio
Class Decoder

java.lang.Object
  extended by games.strategy.net.nio.Decoder

public class Decoder
extends java.lang.Object

A thread to Decode messages from a reader.

Author:
sgb

Constructor Summary
Decoder(NIOSocket nioSocket, NIOReader reader, IErrorReporter reporter, IObjectStreamFactory objectStreamFactory, java.lang.String threadSuffix)
           
 
Method Summary
 void add(java.nio.channels.SocketChannel channel, QuarantineConversation conversation)
           
 void closed(java.nio.channels.SocketChannel channel)
           
static java.io.Externalizable getTemplate(byte type)
           
static byte getType(java.lang.Object msg)
          Most messages we pass will be one of the types below since each of these is externalizable, we can reduce network traffic considerably by skipping the writing of the full identifiers, and simply write a single byte to show the type.
 void shutDown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Decoder

public Decoder(NIOSocket nioSocket,
               NIOReader reader,
               IErrorReporter reporter,
               IObjectStreamFactory objectStreamFactory,
               java.lang.String threadSuffix)
Method Detail

shutDown

public void shutDown()

getTemplate

public static java.io.Externalizable getTemplate(byte type)

getType

public static byte getType(java.lang.Object msg)
Most messages we pass will be one of the types below since each of these is externalizable, we can reduce network traffic considerably by skipping the writing of the full identifiers, and simply write a single byte to show the type.


add

public void add(java.nio.channels.SocketChannel channel,
                QuarantineConversation conversation)

closed

public void closed(java.nio.channels.SocketChannel channel)