public class SimplePacket extends java.lang.Object implements java.lang.Comparable<SimplePacket>
| Constructor and Description |
|---|
SimplePacket(int seq,
boolean checksum,
byte[] buf)
Constructs a SimplePacket with sequence number, checksum validation, and
the data.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(SimplePacket pkt)
Not usable
|
byte[] |
getData()
Returns the bytes delivered by the packet
|
int |
getPred()
Not usable
|
int |
getSeq()
Returns the sequence number of the packet
|
boolean |
isValidCheckSum()
Returns true if the packet has a valid checksum; otherwise, false
|
public SimplePacket(int seq,
boolean checksum,
byte[] buf)
seq - the sequence number starting from 1checksum - true or false to indicate the validation of its checksumbuf - the delivered data in the packetpublic int getSeq()
public boolean isValidCheckSum()
public byte[] getData()
public int getPred()
public int compareTo(SimplePacket pkt)
compareTo in interface java.lang.Comparable<SimplePacket>