Overview | Package | Class | Tree | Deprecated | Index | Help | |||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--mil.navy.nps.dis.PduElement
Data is serialized or read from byte array input or output streams, which are closely related to the datagram buffers used to read or write datagrams to the wire.
This conforms to the SerializationInterface, a "protocol" (in obj-c terminology) that defines an abstract interface. See that interface for details. It also supports the Cloneable interface, with a public visibility rather than the default protected visibility.
All elements should implement a length() method, which specifies how many bytes the object will take up when serialized. Note that this might not be the same size as the current object; for example, the DIS standard specifies padding in a number of places to bring things up to word boundaries. The padding is not present in the object's ivars, but is when the object is written to the wire. Also, the length of a PDU might change over time, as (for example) more articulation parameters get added to the ESPDU.
As a debugging and analysis aid, printValues will dump to stdout the values of all the instance variables, plus any other information deemed appropriate. The printValues method takes an argument of the number of spaces to indent the values, to make things prettier. Typically you'll increment the indent value as you go farther down the object heirarchy.
Constructor Summary | |
PduElement()
|
Method Summary | |
java.lang.Object | clone()
Makes deep copies of all the instance variables, so we don't have two objects pointing to the same data. |
void | deSerialize(java.io.DataInputStream inputStream)
Deserialize our data from the input stream. |
int | length()
Returns the length of the object when serialized in a stream. |
void | printValues(int indentLevel,
java.io.PrintStream printStream)
Prints the generated serialized object for debugging. |
void | serialize(java.io.DataOutputStream outputStream)
Serialize our data out to the stream. |
Methods inherited from class java.lang.Object | |
Constructor Detail |
public PduElement()
Method Detail |
public abstract void serialize(java.io.DataOutputStream outputStream)
super.Serialize()
to make sure
the superclasse's data is serialized out. The order
in which instance variables are serialized is significant. They must
be serialized in the same order they appear in the DIS
spec.
Prints out some information during execution if debugging flag is set.
outputStream
- the stream to which this object is serializedpublic abstract void deSerialize(java.io.DataInputStream inputStream)
super.deSerialize
to make sure
the superclass's data are properly affected. The order
in which instance variables are serialized is significant. They must
be deSerialized in the same order as they have been serialized as specified by the DIS spec.
inputStream
- the stream from which this object is initializedpublic abstract int length()
public abstract void printValues(int indentLevel, java.io.PrintStream printStream)
indentLevel
- number of spaces to indent for visibility
printstream
- defines the ouput streampublic java.lang.Object clone()
Overview | Package | Class | Tree | Deprecated | Index | Help | |||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |