Modifier and Type | Method and Description |
---|---|
protected abstract void |
doRead(DataInputStream stream,
int version)
Subclasses should implement this method to read the data this message
object contains.
|
T |
getType() |
int |
getVersion() |
void |
read(DataInputStream stream)
Reads the message version and than calls
doRead . |
void |
write(DataOutputStream stream)
Writes the message type and version to the stream.
|
public int getVersion()
public void write(DataOutputStream stream) throws IOException, NewerMessageVersionException
stream
- IOException
NewerMessageVersionException
public void read(DataInputStream stream) throws IOException, NewerMessageVersionException
doRead
. The message type id
not read because it must be read before to decide which message object to create.stream
- the stream to read the data fromIOException
NewerMessageVersionException
- if a version newer than the version
of this class is readprotected abstract void doRead(DataInputStream stream, int version) throws IOException
stream
- the stream to read the data fromversion
- the version which was read (smaller or equal to the
version of this class)IOException