games.strategy.net.nio
Class SocketWriteData

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

public class SocketWriteData
extends java.lang.Object

A packet of data to be written over the network.

Packets do not correspond to ip packets. A packet is just the data for one serialized object.

The packet is written over the network as 32 bits indicating the size in bytes, then the data itself.

Author:
sgb

Constructor Summary
SocketWriteData(byte[] data, int count)
           
 
Method Summary
 int getWriteCalls()
           
 int size()
           
 java.lang.String toString()
           
 boolean write(java.nio.channels.SocketChannel channel)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SocketWriteData

public SocketWriteData(byte[] data,
                       int count)
Method Detail

size

public int size()

getWriteCalls

public int getWriteCalls()

write

public boolean write(java.nio.channels.SocketChannel channel)
              throws java.io.IOException
Returns:
true if the write has written the entire message
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object