Class games.Battle.shared.comm.BattlePacket
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class games.Battle.shared.comm.BattlePacket

java.lang.Object
   |
   +----games.Battle.shared.comm.BattlePacket

public class BattlePacket
extends Object
An abstract base class for all battle communication data packets.

Classes derived from BattlePacket encapsulate some sort of object that needs to be transmitted between the server game engine and the client game player, in either direction.

Derived classes implement the methods toBytes() and fromBytes() to convert themselves to and from a stream of bytes. BattlePacket implements the writeTo() and readFrom() methods to provide transmission of the data to and from an Input/OutputStream


Constructor Index

 o BattlePacket()

Method Index

 o fromBytes(byte[])
Converts the given array of bytes into a particular BattlePacket.
 o readFrom(InputStream)
Reads data from the given input stream and builds a particular BattlePacket from that data.
 o toBytes()
Converts this BattlePacket to an array of bytes for transmission.
 o writeTo(OutputStream)
Writes this BattlePacket to the given output stream

Constructors

 o BattlePacket
  public BattlePacket()

Methods

 o toBytes
  protected abstract byte[] toBytes()
Converts this BattlePacket to an array of bytes for transmission.
 o fromBytes
  protected abstract void fromBytes(byte data[])
Converts the given array of bytes into a particular BattlePacket.
Parameters:
data - the array of data to be converted
 o readFrom
  public int readFrom(InputStream is) throws IOException
Reads data from the given input stream and builds a particular BattlePacket from that data.
Parameters:
is - the input stream from which the data is pulled
 o writeTo
  public void writeTo(OutputStream os) throws IOException
Writes this BattlePacket to the given output stream
Parameters:
os - the output stream on which to write the data

All Packages  Class Hierarchy  This Package  Previous  Next  Index