j_waste.network
Class ArbitraryPacket

java.lang.Object
  extended byj_waste.network.Packet
      extended byj_waste.network.ArbitraryPacket

public class ArbitraryPacket
extends Packet

This class represents the ArbitraryPacket which is an arbitrary packet and can contain any data.

Version:
0.1
Author:
Fredrik Hultin (frehul@users.sourceforge.net)

Field Summary
 
Fields inherited from class j_waste.network.Packet
packet
 
Constructor Summary
ArbitraryPacket(byte[] field, int size)
          Constructs a new ArbitraryPacket with the specified field and size.
 
Method Summary
 void finalizePacket()
          Finalizes the packet.
 byte[] getField()
          Returns the field (bytes) of this packet.
 int getSize()
          This method returns the size of the packet.
 byte[] toByteArray()
          Returns a byte array representation of the packet.
 
Methods inherited from class j_waste.network.Packet
padCD, reverseBytes, reverseInt, reverseShort, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArbitraryPacket

public ArbitraryPacket(byte[] field,
                       int size)
Constructs a new ArbitraryPacket with the specified field and size.

Parameters:
field - The bytes that this packet will contain.
size - The size of the packet (the length of the field array)
Method Detail

getField

public byte[] getField()
Returns the field (bytes) of this packet.

Returns:
the bytes that this packet contains.

getSize

public int getSize()
This method returns the size of the packet.

Returns:
The size of the packet

toByteArray

public byte[] toByteArray()
Returns a byte array representation of the packet.

Specified by:
toByteArray in class Packet
Returns:
a byte array representation of the packet.

finalizePacket

public void finalizePacket()
Finalizes the packet.

Specified by:
finalizePacket in class Packet