Package it.polito.appeal.traci.protocol
Class Command
java.lang.Object
it.polito.appeal.traci.protocol.Command
Represents a single TraCI command, with its identifier and content. It can
be used either as a request (i.e. from client to server) and as a response
(i.e. from server to client). The "command" term reflects the description
in the wiki.
Each command is characterized by a type identifier and a variable-sized
content. The command can be constructed either from a data block (a
Storage
) or from scratch; its content can be read or written to a
Storage
.- Author:
- Enrico Gueli <enrico.gueli@polito.it>
- See Also:
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
Command
Builds a command from aStorage
received from the other endpoint.Note that this will advance the storage's internal pointer to the next data.
- Parameters:
rawStorage
- raw storage
-
Command
public Command(int id) Creates a command with a given identifier and an empty content.- Parameters:
id
- id
-
-
Method Details
-
id
public int id()Returns the type identifier.- Returns:
- the id
-
content
Returns the content.- Returns:
- the content
-
writeRawTo
Writes the serialized form of this command to the givenStorage
object.Note: this will advance the internal pointer of the given storage.
- Parameters:
out
- output
-
rawSize
public int rawSize()Returns the expected size of the serialized form of this command.- Returns:
- raw size
-