|
J-Sim v1.2.1-p7 API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectdrcl.DrclObj
drcl.net.Packet
This class defines the base class for implementing packets. A packet consists of a header and a body. The header structure should be further defined in subclasses. This class defines the interface a subclass should/would implement, and implements the setter/getter methods for the encapsulated body object, the packet size and the header size.
| Field Summary | |
java.lang.Object |
body
|
int |
headerSize
|
long |
id
The packet ID that is used and maintained by instrument components, should be globally and uniquely recognized. |
int |
size
|
| Constructor Summary | |
Packet()
|
|
Packet(int packetSize_)
|
|
Packet(int headerSize_,
int bodySize_,
java.lang.Object body_)
|
|
| Method Summary | |
java.lang.String |
_toString(java.lang.String separator_)
Prints the packet header. |
void |
duplicate(java.lang.Object source_)
opies the content of the source_ object to this object. |
boolean |
equals(java.lang.Object that_)
Returns true if that_ is a packet, and its packet size,
header size and the encapsulated object are all equal to those of this
packet. |
java.lang.Object |
getBody()
Returns the encapsulated object of this packet. |
long |
getByteCount()
Returns the byte count of this packet in the connection to which this packet belongs. |
int |
getHeaderSize()
Returns the header size of this packet. |
abstract java.lang.String |
getName()
Returns the name of this packet. |
int |
getNumberCount()
|
int |
getPacketCount()
Returns the count of this packet in the connection to which this packet belongs. |
int |
getPacketSize()
Returns the packet size of this packet. |
java.lang.String |
getPacketType()
Returns the type of packet. |
int |
getSize()
Returns the packet size of this packet. |
long |
getSizeCount()
|
double |
getTimestamp()
|
boolean |
isByteCountSupported()
|
boolean |
isPacketCountSupported()
|
boolean |
isTimestampSupported()
|
void |
setBody(java.lang.Object b_,
int bodySize_)
Sets the encapsulated object of this packet. |
void |
setBody(Packet b_)
Sets the encapsulated object of this packet with another packet. |
void |
setHeaderSize(int hsize_)
Sets the header size of this packet. |
void |
setPacketSize(int packetSize_)
Sets the packet size of this packet. |
void |
setSize(int packetSize_,
int headerSize_)
Sets the packet and header sizes of this packet. |
void |
setTimestamp(double time_)
|
java.lang.String |
toString()
Prints the content of this packet; subclasses should override _toString(String). |
java.lang.String |
toString(java.lang.String separator_)
Prints the content of this packet; subclasses should override _toString(String). |
void |
wraps(Packet p_)
Wraps the argument packet as the body of this packet. |
| Methods inherited from class drcl.DrclObj |
clone |
| Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface drcl.net.PacketWrapper |
clone |
| Field Detail |
public java.lang.Object body
public int size
public int headerSize
public long id
| Constructor Detail |
public Packet()
public Packet(int packetSize_)
public Packet(int headerSize_,
int bodySize_,
java.lang.Object body_)
| Method Detail |
public void duplicate(java.lang.Object source_)
DrclObjsource_ object to this object.
he subclass must implement this method to realize DrclObj.clone().
duplicate in interface ObjectDuplicableduplicate in class DrclObjpublic abstract java.lang.String getName()
public java.lang.Object getBody()
public void setBody(Packet b_)
public void wraps(Packet p_)
wraps in interface PacketWrapper
public void setBody(java.lang.Object b_,
int bodySize_)
public int getPacketSize()
public int getSize()
getSize in interface Countablepublic void setPacketSize(int packetSize_)
public void setHeaderSize(int hsize_)
public int getHeaderSize()
public java.lang.String getPacketType()
getName() otherwise.
public int getPacketCount()
PacketException if the encapsulated object is not a packet.
public int getNumberCount()
getNumberCount in interface CountablegetPacketCount()public boolean isPacketCountSupported()
public long getByteCount()
PacketException if the encapsulated object is not a packet.
This method approximates the byte count with the byte count obtained from
the encapsulated packet plus the header size times the packet count.
public long getSizeCount()
getSizeCount in interface CountablegetByteCount()public boolean isByteCountSupported()
public double getTimestamp()
public void setTimestamp(double time_)
public boolean isTimestampSupported()
public void setSize(int packetSize_,
int headerSize_)
public java.lang.String toString()
_toString(String).
toString in class DrclObjpublic java.lang.String toString(java.lang.String separator_)
_toString(String).
public java.lang.String _toString(java.lang.String separator_)
public boolean equals(java.lang.Object that_)
that_ is a packet, and its packet size,
header size and the encapsulated object are all equal to those of this
packet.
|
J-Sim v1.2.1-p7 API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||