public final class ChannelAccessVersionTCPClientMessage extends ChannelAccessVersionMessage
CA_PROTO_VERSION message that is sent from a
client to a server via TCP. This message is usually send at the start of a
new TCP connection in order to communicate the protocol version supported by
the client and set the priority that should be associated with this
connection. However, some servers might not consider the specified priority.ChannelAccessCommand.CA_PROTO_VERSION,
ChannelAccessVersionUDPMessage,
ChannelAccessVersionTCPServerMessageversioncommand, originalMessageHeader| Constructor and Description |
|---|
ChannelAccessVersionTCPClientMessage(ChannelAccessVersion version,
short priority)
Creates a
CA_PROTO_VERSION message. |
| Modifier and Type | Method and Description |
|---|---|
protected static ChannelAccessVersionTCPClientMessage |
deserialize(ChannelAccessMessageHeader messageHeader,
ByteSource byteSource,
boolean headerOnly)
Constructs a message from a header and a byte source.
|
boolean |
equals(java.lang.Object obj)
Tells whether the specified object represents the same message.
|
short |
getPriority()
Returns the priority requested by the client.
|
int |
hashCode()
Returns a hash code value for this message.
|
protected void |
serialize(ByteSink byteSink,
ChannelAccessVersion version,
int maxPayloadSize,
java.nio.charset.Charset charset)
Serializes this message to a byte sink.
|
java.lang.String |
toString()
Returns a string representation of this message.
|
getVersionaddByteArrayToStringBuilder, calculatePaddingSize, getCommand, getOriginalMessageHeader, hasOriginalMessageHeader, serializeHeader, verify, verifyHeaderpublic ChannelAccessVersionTCPClientMessage(ChannelAccessVersion version, short priority)
CA_PROTO_VERSION message. This constructor should
be used to create a message that is supposed to be sent from a client to
a server using the TCP protocol.version - Channel Access version supported by the client.priority - priority that should be associated with this TCP connection.
This number must be between
ChannelAccessConstants.MIN_PRIORITY and
ChannelAccessConstants.MAX_PRIORITY. Higher numbers
mean a higher priority.InvalidPriorityException - if the specified priority is out of range.public short getPriority()
ChannelAccessConstants.MIN_PRIORITY and
ChannelAccessConstants.MAX_PRIORITY.protected void serialize(ByteSink byteSink, ChannelAccessVersion version, int maxPayloadSize, java.nio.charset.Charset charset)
ChannelAccessMessageChannelAccessMessageCodec.serialize in class ChannelAccessMessagebyteSink - byte sink that is used for writing the serialized data.version - protocol version to stay compatible with. This is the protocol
version of the peer the message is sent to.maxPayloadSize - maximum size of the payload.charset - encoding to use for serializing the string data (e.g. channel
names, error strings, string data-values).public boolean equals(java.lang.Object obj)
ChannelAccessMessageTells whether the specified object represents the same message.
Two messages are considered equal if they are of the same type and have the same headers and payload. For comparing the types, the actual Java type and not just the Channel Access command is compared.
equals in class ChannelAccessVersionMessageobj - reference object with which this object is compared.true if obj is a message that is of the
same type and has the same headers and payload as this message.
false if obj is null or of
a different type than this message or differs in the headers or
payload.public int hashCode()
ChannelAccessMessageReturns a hash code value for this message. This method is supported for the benefit of hash tables. The hash code is calculated as a combination of the hash codes of this messages headers (including the Channel Access command) and its payload (if present).
If two messages are equal (as indicated by the return value of
ChannelAccessMessage.equals(Object)), they also have the same hash code. However, the
fact that two messages have the same hash code does not imply that they
are equal.
hashCode in class ChannelAccessVersionMessagepublic java.lang.String toString()
ChannelAccessMessagetoString in class ChannelAccessMessageprotected static ChannelAccessVersionTCPClientMessage deserialize(ChannelAccessMessageHeader messageHeader, ByteSource byteSource, boolean headerOnly)
ChannelAccessMessageCodec.messageHeader - CA message header.byteSource - byte source for reading the message's payload (if any).headerOnly - if true this method will not try to read the
payload but just read the header. This is useful for reading a
message that is sent in the payload of a
ChannelAccessErrorMessage. Such a message will have
all headers but no payload (even so the payload size might be
non-zero).java.nio.BufferUnderflowException - if there is not enough data in the byte source to read the
complete payload.InvalidPriorityException - if the priority specified in the message header is out of
range.Copyright © 2014–2018 aquenos GmbH. All rights reserved.