Package edu.nps.moves.dis7.pdus
Class Pdu
java.lang.Object
edu.nps.moves.dis7.pdus.Pdu
- All Implemented Interfaces:
Marshaller,Serializable
- Direct Known Subclasses:
LiveEntityFamilyPdu,LiveEntityPdu,PduBase
Base class of PduBase and LiveEntityPdu
IEEE Std 1278.1-2012, IEEE Standard for Distributed Interactive Simulation - Application Protocols
- See Also:
- Serialized Form
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byteExercise IDprotected shortLength, in bytes, of the PDUprotected DisPduTypeType of pdu, unique for each PDU class uid 4protected DISProtocolFamilyvalue that refers to the protocol family, eg SimulationManagement, et uid 5protected DISProtocolVersionThe version of the protocol.protected intTimestamp value -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanequalsImpl(Object obj)Compare all fields that contribute to the state, ignoring transient and static fields, forthisand the supplied objectbyteGetter forexerciseIDshortGetter forlengthintReturns size of this serialized (marshalled) object in bytesGetter forpduTypeGetter forprotocolFamilyGetter forprotocolVersionintGetter fortimestampbyte[]marshal()A convenience method for marshalling to a byte array.voidmarshal(DataOutputStream dos)Serializes an object to a DataOutputStream.voidmarshal(ByteBuffer byteBuffer)Packs an object into the ByteBuffer.setExerciseID(byte pExerciseID)Setter forexerciseIDsetExerciseID(int pExerciseID)Utility setter forexerciseIDsetLength(int pLength)Utility setter forlengthsetLength(short pLength)Setter forlengthsetPduType(DisPduType pPduType)Setter forpduTypesetProtocolFamily(DISProtocolFamily pProtocolFamily)Setter forprotocolFamilysetProtocolVersion(DISProtocolVersion pProtocolVersion)Setter forprotocolVersionsetTimestamp(int pTimestamp)Setter fortimestamptoString()intunmarshal(DataInputStream dis)Deserializes an object from a DataInputStream.intunmarshal(ByteBuffer byteBuffer)Unpacks a Pdu from the underlying data.
-
Field Details
-
protocolVersion
The version of the protocol. 5=DIS-1995, 6=DIS-1998, 7=DIS-2012 uid 3 -
exerciseID
protected byte exerciseIDExercise ID -
pduType
Type of pdu, unique for each PDU class uid 4 -
protocolFamily
value that refers to the protocol family, eg SimulationManagement, et uid 5 -
timestamp
protected int timestampTimestamp value -
length
protected short lengthLength, in bytes, of the PDU
-
-
Constructor Details
-
Pdu
public Pdu()Constructor
-
-
Method Details
-
getMarshalledSize
public int getMarshalledSize()Returns size of this serialized (marshalled) object in bytes- Specified by:
getMarshalledSizein interfaceMarshaller- Returns:
- serialized size in bytes
- See Also:
- https://en.wikipedia.org/wiki/Marshalling_(computer_science)
-
setProtocolVersion
Setter forprotocolVersion- Parameters:
pProtocolVersion- new value of interest- Returns:
- same object to permit progressive setters
-
getProtocolVersion
Getter forprotocolVersion- Returns:
- value of interest
-
setExerciseID
Setter forexerciseID- Parameters:
pExerciseID- new value of interest- Returns:
- same object to permit progressive setters
-
setExerciseID
Utility setter forexerciseID- Parameters:
pExerciseID- new value of interest- Returns:
- same object to permit progressive setters
-
getExerciseID
public byte getExerciseID()Getter forexerciseID- Returns:
- value of interest
-
setPduType
Setter forpduType- Parameters:
pPduType- new value of interest- Returns:
- same object to permit progressive setters
-
getPduType
Getter forpduType- Returns:
- value of interest
-
setProtocolFamily
Setter forprotocolFamily- Parameters:
pProtocolFamily- new value of interest- Returns:
- same object to permit progressive setters
-
getProtocolFamily
Getter forprotocolFamily- Returns:
- value of interest
-
setTimestamp
Setter fortimestamp- Parameters:
pTimestamp- new value of interest- Returns:
- same object to permit progressive setters
-
getTimestamp
public int getTimestamp()Getter fortimestamp- Returns:
- value of interest
-
setLength
Setter forlength- Parameters:
pLength- new value of interest- Returns:
- same object to permit progressive setters
-
setLength
Utility setter forlength- Parameters:
pLength- new value of interest- Returns:
- same object to permit progressive setters
-
getLength
public short getLength()Getter forlength- Returns:
- value of interest
-
marshal
Serializes an object to a DataOutputStream.- Specified by:
marshalin interfaceMarshaller- Parameters:
dos- the OutputStream- Throws:
Exception- if something goes wrong- See Also:
DataOutputStream
-
unmarshal
Deserializes an object from a DataInputStream.- Specified by:
unmarshalin interfaceMarshaller- Parameters:
dis- the InputStream- Returns:
- marshalled serialized size in bytes
- Throws:
Exception- if something goes wrong- See Also:
DataInputStream, https://en.wikipedia.org/wiki/Marshalling_(computer_science)
-
marshal
Packs an object into the ByteBuffer.- Specified by:
marshalin interfaceMarshaller- Parameters:
byteBuffer- The ByteBuffer at the position to begin writing- Throws:
BufferOverflowException- if byteBuffer is too smallReadOnlyBufferException- if byteBuffer is read onlyException- ByteBuffer-generated exception- See Also:
ByteBuffer
-
unmarshal
Unpacks a Pdu from the underlying data.- Specified by:
unmarshalin interfaceMarshaller- Parameters:
byteBuffer- The ByteBuffer at the position to begin reading- Returns:
- marshalled serialized size in bytes
- Throws:
BufferUnderflowException- if byteBuffer is too smallException- ByteBuffer-generated exception- See Also:
ByteBuffer, https://en.wikipedia.org/wiki/Marshalling_(computer_science)
-
marshal
A convenience method for marshalling to a byte array. This is not as efficient as reusing a ByteBuffer, but it is easy. -
equals
-
equalsImpl
Compare all fields that contribute to the state, ignoring transient and static fields, forthisand the supplied object- Parameters:
obj- the object to compare to- Returns:
- true if the objects are equal, false otherwise.
-
toString
-