|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectj_waste.network.Packet
j_waste.network.HeadedPacket
This class is the base class for headed packets used in J-WASTE.
| Field Summary | |
protected boolean |
iscomplete
|
protected java.nio.ByteBuffer |
packetData
|
protected int |
padBytes
|
| Fields inherited from class j_waste.network.Packet |
packet |
| Constructor Summary | |
HeadedPacket(byte[] pkg)
Constructs a HeadedPacket given a byte array representation of the Packet. |
|
HeadedPacket(int type,
byte[] guid)
Constructs a HeadedPacket of the type specified and with the specified GUID. |
|
| Method Summary | |
static HeadedPacket |
createPacket(byte[] pkg)
Creates a HeadedPacket of the correct subtype as defined in the header embedded in the byte array. |
void |
finalizePacket()
Finalize the packet. |
byte[] |
getData()
Returns the data stored in this packet, null if empty. |
int |
getGeneralType()
Returns the general type of this headed packet. |
byte[] |
getGUID()
Returns the GUID of this HeadedPacket. |
byte[] |
getHeader()
Returns the header of this HeadedPacket, null if incomplete. |
int |
getIntPrio()
Returns the Priority of this HeadedPacket as an integer. |
int |
getIntType()
Returns the type if this HeadedPacket as an integer. |
int |
getLength()
Returns the length of this HeadedPacket. |
byte[] |
getMD5()
Returns the MD5 checksum of this HeadedPacket. |
byte |
getPrio()
Returns the Priority of this HeadedPacket. |
int |
getTTL()
Returns the TTL of this HeadedPacket. |
byte[] |
getType()
Returns the type of this HeadedPacket. |
protected void |
setLength(int l)
Sets the length of this HeadedPacket. |
protected void |
setTTL(int ttl)
Sets the TTL of this HeadedPacket. |
byte[] |
toByteArray()
Returns a byte array representation of this HeadedPacket. |
| 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 |
| Field Detail |
protected java.nio.ByteBuffer packetData
protected boolean iscomplete
protected int padBytes
| Constructor Detail |
public HeadedPacket(int type,
byte[] guid)
type - the type of this HeadedPacket.guid - the GUID of this HeadedPacket.
public HeadedPacket(byte[] pkg)
throws InvalidPacketException
pkg - the Packet.
InvalidPacketException - upon failure to create the HeadedPacket.| Method Detail |
public static HeadedPacket createPacket(byte[] pkg)
throws InvalidPacketException
pkg - the byte array representation of the HeadedPacket.
InvalidPacketException - upon failure to create the packet.protected void setTTL(int ttl)
ttl - the TTL of this HeadedPacket.public int getTTL()
protected void setLength(int l)
l - the length of this HeadedPacket.public int getLength()
public byte[] getType()
public int getIntType()
public byte getPrio()
public int getIntPrio()
public byte[] getHeader()
public byte[] getGUID()
public byte[] getMD5()
public void finalizePacket()
finalizePacket in class Packetpublic byte[] getData()
public byte[] toByteArray()
toByteArray in class Packetpublic int getGeneralType()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||