public class CommunicationTokenHandler extends java.lang.Object implements TokenHandler<CommunicationToken>
Serialize a CommunicationToken to and from binary format.
The stream has the following format:
CommunicationToken = Type(2), CommunicationTokenValueField
CommunicationTokenValueField = TargetActorName, PortCount(2), PortData...
(PortData is repeated PortCount times)
PortData = PortName, ChannelCount(2), ChannelData... (ChannelData is repeated ChannelCount times)
ChannelData = ChannelTokenCount(2), Token... (Token is repeated ChannelTokenCount times;
Its serialized using TokenHandler defined for its data type)
Red (ahuseyno) |
Red (ahuseyno) |
Constructor and Description |
---|
CommunicationTokenHandler() |
Modifier and Type | Method and Description |
---|---|
void |
convertToBytes(CommunicationToken token,
java.io.DataOutputStream outputStream)
Serialize the communication token to the binary according to the format defined in
CommunicationTokenHandler . |
CommunicationToken |
convertToToken(java.io.DataInputStream inputStream,
java.lang.Class<? extends CommunicationToken> tokenType)
Deserialize the token from the stream according to the format defined in
CommunicationTokenHandler . |
public void convertToBytes(CommunicationToken token, java.io.DataOutputStream outputStream) throws java.io.IOException, IllegalActionException
CommunicationTokenHandler
.convertToBytes
in interface TokenHandler<CommunicationToken>
token
- Token to be converted to bytes.outputStream
- The stream to write to.java.io.IOException
- if there is a problem with the outputStreamIllegalActionException
- if there is the state becomes inconsistentTokenHandler.convertToBytes(ptolemy.data.Token, java.io.DataOutputStream)
public CommunicationToken convertToToken(java.io.DataInputStream inputStream, java.lang.Class<? extends CommunicationToken> tokenType) throws java.io.IOException, IllegalActionException
CommunicationTokenHandler
.convertToToken
in interface TokenHandler<CommunicationToken>
inputStream
- The stream to read from.tokenType
- The type of token to be parsed.java.io.IOException
- If the stream cannot be read.IllegalActionException
- Not thrown in this class.TokenHandler.convertToToken(java.io.DataInputStream, Class)