|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectme.edwards.des.net.packet.Packet
public abstract class Packet
Handles packaging and unpackaging of Packets sent between Nodes
in the DES system.
Created on: Oct 17, 2015 at 9:08:41 AM
Nested Class Summary | |
---|---|
static class |
Packet.PacketTypes
Enumerates all the types of Packets and their ID's. Created on: Jan 4, 2015 at 10:50:45 AM |
Field Summary | |
---|---|
private static java.lang.String |
CHARS
|
private static char[] |
HEX
|
private byte |
id
|
private static int |
total
Value used to automatically assign unique integer ID's to Packet Types. |
Constructor Summary | |
---|---|
Packet(byte id)
Initializes a new Packet using an ID defined in Packet.PacketTypes. |
Method Summary | |
---|---|
abstract byte[] |
getBinary()
Returns the binary payload of this Packet as a byte array. |
byte |
getID()
Returns this Packet's ID. |
static Packet.PacketTypes |
lookup(byte id)
Returns the Packet Type from a numeric Type ID. |
static java.lang.String |
toHex(byte b)
Returns a byte as a 2-digit hexadecimal String |
java.lang.String |
toString()
|
static java.lang.String |
toString(byte[] data)
Returns the String representation of a Packet's binary data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final char[] HEX
private static final java.lang.String CHARS
private byte id
private static int total
Constructor Detail |
---|
public Packet(byte id)
id
- ID of PacketMethod Detail |
---|
public byte getID()
Packet.PacketTypes
public abstract byte[] getBinary()
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String toString(byte[] data)
data
- Packet binary payload as byte array
public static java.lang.String toHex(byte b)
b
- Byte to convert
public static Packet.PacketTypes lookup(byte id)
Packet Type
from a numeric Type ID.
id
- Packet Type ID
Invalid Packet
Type
is returned
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |