|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--wonderly.jeaprs.aprs.packet.APRSPacket
This is an APRS packet. It contains 5 pieces of information that are
useful to applications. The from
Callsign, the TNC path
, the type
character, the rest of the packet info
as a string which includes the
type character on the front (because most existing parsers work with
data starting at that point). Finally, the checksum of the packet is
returned by the hashCode() method and is computed once. equals() compares
the from and the packet "info" or data. Thus, duplicate packets can be
detected by checking for hashCode() the same first (which is very efficient),
and then equals() if so and unequal packets are found by checking the hashCode(),
if not the same the packets are not the same. If hashCode() is the same,
then equals() will return false for unequal packets and true for equal packets.
Using hashCode() as a shortcut first comparison is a speed optimization.
Field Summary | |
protected wonderly.jeaprs.ByteString |
from
|
protected wonderly.jeaprs.ByteString |
info
|
protected wonderly.jeaprs.ByteString |
path
|
protected int |
sum
|
protected byte |
type
|
Constructor Summary | |
APRSPacket(wonderly.jeaprs.ByteString from,
wonderly.jeaprs.ByteString path,
byte type,
wonderly.jeaprs.ByteString info)
Construct a new packet object. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Compares from and info of packets for equality. |
byte[] |
getData()
Returns the packet data as a byte array. |
wonderly.jeaprs.ByteString |
getFrom()
|
wonderly.jeaprs.ByteString |
getInfo()
|
wonderly.jeaprs.ByteString |
getPath()
|
byte |
getType()
Returns the packet type character |
int |
hashCode()
|
void |
setType(byte ch)
|
wonderly.jeaprs.ByteString |
toByteString()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected wonderly.jeaprs.ByteString from
protected wonderly.jeaprs.ByteString path
protected byte type
protected wonderly.jeaprs.ByteString info
protected transient int sum
Constructor Detail |
public APRSPacket(wonderly.jeaprs.ByteString from, wonderly.jeaprs.ByteString path, byte type, wonderly.jeaprs.ByteString info)
from
- the from call signpath
- the ax.25 path the packet traveledtype
- the character packet type.info
- the packet data contents including 'type' as first characterMethod Detail |
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public wonderly.jeaprs.ByteString toByteString()
public wonderly.jeaprs.ByteString getFrom()
public void setType(byte ch)
public wonderly.jeaprs.ByteString getPath()
public wonderly.jeaprs.ByteString getInfo()
public byte getType()
public byte[] getData()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |