public class ChannelAccessMessageCodec
extends java.lang.Object
Encoder and decoder for Channel Access messages.
Messages can be encoded (serialized) using one of the encode
methods. They can be decoded (deserialized) using one of the
decode
methods. These methods are safe for concurrent use by
multiple threads.
Problems that occur while encoding or decoding a message a signaled by
exceptions. When an exception is encoutered while trying to decode a message,
the corresponding message may be discarded from the byte source using the
discardNextMessage(ByteSource)
or
discardNextMessageCompletely(ByteSource)
method. In general, the
discardNextMessage(ByteSource)
method is preferrable because it will
work, even if the message is too large to fit in the buffer backing the byte
source. However, in contrast to the
discardNextMessageCompletely(ByteSource)
method, the calling code
has to perform additional work in order to ensure that the message is really
discarded completely.
The character set that is used for encoding and decoding strings in messages
can be configured with the setCharset(Charset)
method. However,
changing the configuration is not thread safe, therefore the calling code
must ensure that no other thread uses the message codec at the same time. By
default, a newly created codec uses the UTF-8 encoding or, if this encoding
is not available on the platform, the platform's default encoding.
The maximum allowed payload size can be configured separately for received
messages (that are decoded) and sent messages (that are encoded) using the
setMaxPayloadReceiveSize(int)
and
setMaxPayloadSendSize(int)
methods. However, changing the
configuration is not thread safe, therefore the calling code must ensure that
no other thread uses the message codec at the same time. By default, a
maximum payload size of 16384 bytes is used. This is
also the smallest maximum payload size that can be configured. The Channel
Access C library (as of EPICS 3.15.0) uses the same default setting. The
upper limit for the maximum payload size is 2147483616
bytes. This limit comes from the fact that this library used 32-bit signed
integers for dealing with message sizes. The Channel Access protocol uses
32-bit unsigned integers and thus would allow a greater limit, however no
reasonable message sent via Channel Access should exceed limit of this
implementation (which is roughly equivalent to a payload size of 2 GB)
anyway.
While this class's encode and decode methods are thread-safe, the methods for changing the configuration are not thread-safe (not even with respect to the encode and decode methods). Therefore, a thread has to ensure that it has exclusive access to a message codec before changing its configuration. Typically, the configuration is only changed once after creating a message codec and never touched later.
Modifier and Type | Field and Description |
---|---|
static int |
MAX_MAX_PAYLOAD_SIZE
Largest valid value for the maximum payload-size option.
|
static int |
MIN_MAX_PAYLOAD_SIZE
Smallest valid value for the maximum payload-size option.
|
Constructor and Description |
---|
ChannelAccessMessageCodec()
Creates a message codec that uses the UTF-8 character set or, if this
character set is not available on the platform, the platform's default
character set.
|
public static final int MIN_MAX_PAYLOAD_SIZE
public static final int MAX_MAX_PAYLOAD_SIZE
public ChannelAccessMessageCodec()
public int getMaxPayloadReceiveSize()
ReceivedMessageTooLargeException
. The default value is
16384.ChannelAccessConstants.MESSAGE_SIZE_ALIGNMENT
.public void setMaxPayloadReceiveSize(int maxPayloadReceiveSize)
Sets the maximum payload size for received messages. If a received
message's payload exceeds this size, the deserialization routine will
throw a ReceivedMessageTooLargeException
. The default value is
16384 which is also the smallest allowed value.
Caution: This method is not thread-safe. It should be called at initialization time, before the message codec is used. If the value is supposed to be changed later, it has to be ensured that no other thread is using this message codec concurrently.
maxPayloadReceiveSize
- new maxium payload size for received Channel Access messages
(in bytes). Must be at least 16384.
Must not be greater than 2147483616. If
this number is not a multiple of
ChannelAccessConstants.MESSAGE_SIZE_ALIGNMENT
, the
next smaller number that is a multiple of
MESSAGE_SIZE_ALIGNMENT
is used.java.lang.IllegalArgumentException
- if maxPayloadReceiveSize
is less than
16384 or greater than
2147483616.public int getMaxPayloadSendSize()
SerializedPayloadTooLargeException
. The default value is
16384.ChannelAccessConstants.MESSAGE_SIZE_ALIGNMENT
.public void setMaxPayloadSendSize(int maxPayloadSendSize)
Sets the maximum payload size for sent messages. If a message's payload
exceeds this size, the serialization routine will throw a
SerializedPayloadTooLargeException
. The default value is
16384 which is also the smallest allowed value.
Caution: This method is not thread-safe. It should be called at initialization time, before the message codec is used. If the value is supposed to be changed later, it has to be ensured that no other thread is using this message codec concurrently.
maxPayloadSendSize
- new maxium payload size for sent Channel Access messages (in
bytes). Must be at least 16384. Must
not be greater than 2147483616. If this
number is not a multiple of
ChannelAccessConstants.MESSAGE_SIZE_ALIGNMENT
, the
next smaller number that is a multiple of
MESSAGE_SIZE_ALIGNMENT
is used.java.lang.IllegalArgumentException
- if maxPayloadSendSize
is less than
16384 or greater than
2147483616.public java.nio.charset.Charset getCharset()
public void setCharset(java.nio.charset.Charset charset)
Sets the character set used by this message codec. The character set determines how strings are converted to bytes and the other-way round. This affects the over-the-wire format of channel names, error strings and string values. The default is the UTF-8 charset. If this charset is not available, the default is the platform's default charset.
Caution: This method is not thread-safe. It should be called at initialization time, before the message codec is used. If the value is supposed to be changed later, it has to be ensured that no other thread is using this message codec concurrently.
charset
- new character-set to use for encoding and decoding strings.public void encodeMessageToUDPServer(ByteSink byteSink, ChannelAccessMessage message, ChannelAccessVersion version)
ChannelAccessVersionUDPMessage
and
ChannelAccessSearchClientMessage
can be sent via this protocol.byteSink
- byte sink the encoded message is written to. The message is
written in an atomic operation, so it is either written
completely or nothing is written at all.message
- message to be encoded.version
- protocol version that shall be used. This implementation only
supports protocol versions equal to or greater than
ChannelAccessVersion.V4_4
.java.nio.BufferOverflowException
- if this exception is thrown by the byte sink and thus the
message cannot be written completely.java.lang.IllegalArgumentException
- if this message is of a type that cannot be sent from a
client to a server via UDP.SerializedChannelNameTooLargeException
- if a channel name has to be serialized and the serialized
form of the channel name is too long.SerializedPayloadTooLargeException
- if the message cannot be sent because the payload would be
larger than the configured maximum payload send size or the
specified protocol version is older than Channel Access
version 4.9 and the payload would be larger than 65528 bytes
or the count exceeds 65535 elements.UnsupportedInThisVersionException
- if this message is not support in the protocol version
specified by version
.java.lang.UnsupportedOperationException
- if this message has been constructed by deserializing it from
headers only and thus it is incomplete.UnsupportedProtocolVersionException
- if the specified version
is older than the
oldest supported protocol version for this message. In
general, all Channel Access versions since version 4.4 should
be supported.public void encodeMessageToUDPClient(ByteSink byteSink, ChannelAccessMessage message, ChannelAccessVersion version)
ChannelAccessVersionUDPMessage
and
ChannelAccessSearchUDPServerMessage
,
ChannelAccessEchoMessage
, ChannelAccessErrorMessage
, and
ChannelAccessNotFoundMessage
can be sent via this protocol.byteSink
- byte sink the encoded message is written to. The message is
written in an atomic operation, so it is either written
completely or nothing is written at all.message
- message to be encoded.version
- protocol version that shall be used. This implementation only
supports protocol versions equal to or greater than
ChannelAccessVersion.V4_4
.java.nio.BufferOverflowException
- if this exception is thrown by the byte sink and thus the
message cannot be written completely.java.lang.IllegalArgumentException
- if this message is of a type that cannot be sent from a
server to a client via UDP.SerializedPayloadTooLargeException
- if the message cannot be sent because the payload would be
larger than the configured maximum payload send size or the
specified protocol version is older than Channel Access
version 4.9 and the payload would be larger than 65528 bytes
or the count exceeds 65535 elements.UnsupportedInThisVersionException
- if this message is not support in the protocol version
specified by version
.java.lang.UnsupportedOperationException
- if this message has been constructed by deserializing it from
headers only and thus it is incomplete.UnsupportedProtocolVersionException
- if the specified version
is older than the
oldest supported protocol version for this message. In
general, all Channel Access versions since version 4.4 should
be supported.public void encodeMessageToRepeater(ByteSink byteSink, ChannelAccessMessage message, ChannelAccessVersion version)
ChannelAccessBeaconMessage
can be sent via this protocol.byteSink
- byte sink the encoded message is written to. The message is
written in an atomic operation, so it is either written
completely or nothing is written at all.message
- message to be encoded.version
- protocol version that shall be used. This implementation only
supports protocol versions equal to or greater than
ChannelAccessVersion.V4_4
.java.nio.BufferOverflowException
- if this exception is thrown by the byte sink and thus the
message cannot be written completely.java.lang.IllegalArgumentException
- if this message is of a type that cannot be sent to a
repeater.public void encodeMessageFromRepeater(ByteSink byteSink, ChannelAccessMessage message, ChannelAccessVersion version)
ChannelAccessVersionUDPMessage
,
ChannelAccessRepeaterConfirmMessage
, and
ChannelAccessBeaconMessage
can be sent via this protocol.byteSink
- byte sink the encoded message is written to. The message is
written in an atomic operation, so it is either written
completely or nothing is written at all.message
- message to be encoded.version
- protocol version that shall be used. This implementation only
supports protocol versions equal to or greater than
ChannelAccessVersion.V4_4
.java.nio.BufferOverflowException
- if this exception is thrown by the byte sink and thus the
message cannot be written completely.java.lang.IllegalArgumentException
- if this message is of a type that cannot be sent from a
repeater to a client via UDP.public void encodeMessageToTCPServer(ByteSink byteSink, ChannelAccessMessage message, ChannelAccessVersion version)
ChannelAccessVersionTCPClientMessage
,
ChannelAccessSubscriptionClientMessage
,
ChannelAccessCancelSubscriptionClientMessage
,
ChannelAccessReadClientMessage
, ChannelAccessWriteMessage
, ChannelAccessEventsOffMessage
,
ChannelAccessEventsOnMessage
,
ChannelAccessReadSyncMessage
,
ChannelAccessDisconnectChannelMessage
,
ChannelAccessReadNotifyClientMessage
,
ChannelAccessConnectChannelClientMessage
,
ChannelAccessWriteNotifyClientMessage
,
ChannelAccessUserNameMessage
,
ChannelAccessHostNameMessage
, ChannelAccessEchoMessage
,
and ChannelAccessSearchClientMessage
can be sent via this
protocol.byteSink
- byte sink the encoded message is written to. The message is
written in an atomic operation, so it is either written
completely or nothing is written at all.message
- message to be encoded.version
- protocol version that shall be used. This implementation only
supports protocol versions equal to or greater than
ChannelAccessVersion.V4_4
.java.nio.BufferOverflowException
- if this exception is thrown by the byte sink and thus the
message cannot be written completely.java.lang.IllegalArgumentException
- if this message is of a type that cannot be sent from a
client to a server via TCP.SerializedPayloadTooLargeException
- if the message cannot be sent because the payload would be
larger than the configured maximum payload send size or the
specified protocol version is older than Channel Access
version 4.9 and the payload would be larger than 65528 bytes
or the count exceeds 65535 elements.UnsupportedInThisVersionException
- if this message is not support in the protocol version
specified by version
.java.lang.UnsupportedOperationException
- if this message has been constructed by deserializing it from
headers only and thus it is incomplete.UnsupportedProtocolVersionException
- if the specified version
is older than the
oldest supported protocol version for this message. In
general, all Channel Access versions since version 4.4 should
be supported.public void encodeMessageToTCPClient(ByteSink byteSink, ChannelAccessMessage message, ChannelAccessVersion version)
ChannelAccessVersionTCPServerMessage
,
ChannelAccessSubscriptionServerMessage
,
ChannelAccessCancelSubscriptionServerMessage
,
ChannelAccessReadServerMessage
,
ChannelAccessReadSyncMessage
, ChannelAccessErrorMessage
,
ChannelAccessDisconnectChannelMessage
,
ChannelAccessReadNotifyServerMessage
,
ChannelAccessConnectChannelServerMessage
,
ChannelAccessWriteNotifyServerMessage
,
ChannelAccessAccessRightsMessage
,
ChannelAccessEchoMessage
,
ChannelAccessConnectChannelFailedMessage
,
ChannelAccessChannelDisconnectedByServerMessage
,
ChannelAccessSearchTCPServerMessage
, and
ChannelAccessNotFoundMessage
can be sent via this protocol.byteSink
- byte sink the encoded message is written to. The message is
written in an atomic operation, so it is either written
completely or nothing is written at all.message
- message to be encoded.version
- protocol version that shall be used. This implementation only
supports protocol versions equal to or greater than
ChannelAccessVersion.V4_4
.java.nio.BufferOverflowException
- if this exception is thrown by the byte sink and thus the
message cannot be written completely.java.lang.IllegalArgumentException
- if this message is of a type that cannot be sent from a
server to a client via TCP.SerializedPayloadTooLargeException
- if the message cannot be sent because the payload would be
larger than the configured maximum payload send size or the
specified protocol version is older than Channel Access
version 4.9 and the payload would be larger than 65528 bytes
or the count exceeds 65535 elements.UnsupportedInThisVersionException
- if this message is not support in the protocol version
specified by version
.java.lang.UnsupportedOperationException
- if this message has been constructed by deserializing it from
headers only and thus it is incomplete.UnsupportedProtocolVersionException
- if the specified version
is older than the
oldest supported protocol version for this message. In
general, all Channel Access versions since version 4.4 should
be supported.public long discardNextMessage(ByteSource byteSource)
byteSource
- byte source from which the message headers are read and whose
data is discarded.java.nio.BufferUnderflowException
- if the byte source does not contain enough data to read the
message headers. In this case no bytes are discarded at all
and the byte source is left in the state it was in before
calling this method.public void discardNextMessageCompletely(ByteSource byteSource)
discardNextMessage(ByteSource)
method, this method will not
discard any bytes if the number of bytes remaining in the byte source are
less than the number of bytes that is expected according to the message
headers.byteSource
- byte source from which the message headers are read and whose
data is discarded.java.nio.BufferUnderflowException
- if the message headers cannot be read completely or there are
not enough bytes remaining in the byte source for discarding
the whole message.public ChannelAccessMessage decodeMessageToUDPServer(ByteSource byteSource, ChannelAccessVersion version)
byteSource
- byte source from which the message is read (never
null
). The message is read in an atomic
operation, thus it is either read completely or no data is
read at all, leaving the byte source in its original state.version
- protocol version that shall be used (never null
).
This implementation only supports protocol versions equal to
or greater than ChannelAccessVersion.V4_4
.null
).java.nio.BufferUnderflowException
- if the byte source does not contain enough data to read the
whole message.MalformedMessageException
- if the message's size is not well aligned.ReceivedMessageTooLargeException
- if the message's payload is larger than the configured
maximum payload receive size.UnsupportedMessageTypeException
- if the message type specified in the header is not supported
by this implementation (for example because it is only
expected to be received over a different transport).protected static ChannelAccessMessage decodeMessageToUDPServer(ChannelAccessMessageHeader messageHeader, ByteSource byteSource, boolean headerOnly, java.nio.charset.Charset charset, int maxPayloadSize, ChannelAccessVersion version)
messageHeader
- headers of the message that is supposed to be decoded.byteSource
- byte source from which the message's payload is read (never
null
).headerOnly
- if true
, only the message header is read. This
option is useful when the message that was attached to an
error message is reconstructed, because in this case only the
header is available. If this option is set, no data is read
from the byte source.charset
- character set that is used to decode strings in the message
(never null
).maxPayloadSize
- maximum size the message's payload may have. If the message's
header specifies a payload size that exceeds this limit, a
ReceivedMessageTooLargeException
exception is thrown.version
- protocol version that shall be used (never null
).
This implementation only supports protocol versions equal to
or greater than ChannelAccessVersion.V4_4
.null
).java.nio.BufferUnderflowException
- if the byte source does not contain enough data to read the
whole payload.MalformedMessageException
- if the message's size is not well aligned.ReceivedMessageTooLargeException
- if the message's payload is larger than
maxPayloadSize
.UnsupportedMessageTypeException
- if the message type specified in the header is not supported
by this implementation (for example because it is only
expected to be received over a different transport).public ChannelAccessMessage decodeMessageToUDPClient(ByteSource byteSource, ChannelAccessVersion version, java.net.Inet4Address serverAddress, int serverPort)
byteSource
- byte source from which the message is read (never
null
). The message is read in an atomic
operation, thus it is either read completely or no data is
read at all, leaving the byte source in its original state.version
- protocol version that shall be used (never null
).
This implementation only supports protocol versions equal to
or greater than ChannelAccessVersion.V4_4
.serverAddress
- IP address of the server that sent the message (never
null
).serverPort
- UDP port of the server that sent the message.null
).java.nio.BufferUnderflowException
- if the byte source does not contain enough data to read the
whole message.MalformedMessageException
- if the message's size is not well aligned.ReceivedMessageTooLargeException
- if the message's payload is larger than the configured
maximum payload receive size.UnsupportedMessageTypeException
- if the message type specified in the header is not supported
by this implementation (for example because it is only
expected to be received over a different transport).public ChannelAccessMessage decodeMessageToTCPServer(ByteSource byteSource, ChannelAccessVersion version)
byteSource
- byte source from which the message is read (never
null
). The message is read in an atomic
operation, thus it is either read completely or no data is
read at all, leaving the byte source in its original state.version
- protocol version that shall be used (never null
).
This implementation only supports protocol versions equal to
or greater than ChannelAccessVersion.V4_4
.null
).java.nio.BufferUnderflowException
- if the byte source does not contain enough data to read the
whole message.MalformedMessageException
- if the message's size is not well aligned.ReceivedMessageTooLargeException
- if the message's payload is larger than the configured
maximum payload receive size.ShortPayloadException
- if the payload size specified in the message's header is too
small considering the message type and the other parameters
in the message's header.UnsupportedMessageTypeException
- if the message type specified in the header is not supported
by this implementation (for example because it is only
expected to be received over a different transport).protected static ChannelAccessMessage decodeMessageToTCPServer(ChannelAccessMessageHeader messageHeader, ByteSource byteSource, boolean headerOnly, java.nio.charset.Charset charset, int maxPayloadSize, ChannelAccessVersion version)
messageHeader
- headers of the message that is supposed to be decoded.byteSource
- byte source from which the message's payload is read (never
null
).headerOnly
- if true
, only the message header is read. This
option is useful when the message that was attached to an
error message is reconstructed, because in this case only the
header is available. If this option is set, no data is read
from the byte source.charset
- character set that is used to decode strings in the message
(never null
).maxPayloadSize
- maximum size the message's payload may have. If the message's
header specifies a payload size that exceeds this limit, a
ReceivedMessageTooLargeException
exception is thrown.version
- protocol version that shall be used (never null
).
This implementation only supports protocol versions equal to
or greater than ChannelAccessVersion.V4_4
.null
).java.nio.BufferUnderflowException
- if the byte source does not contain enough data to read the
whole payload.MalformedMessageException
- if the message's size is not well aligned.ReceivedMessageTooLargeException
- if the message's payload is larger than
maxPayloadSize
.ShortPayloadException
- if the payload size specified in the message's header is too
small considering the message type and the other parameters
in the message's header.UnsupportedMessageTypeException
- if the message type specified in the header is not supported
by this implementation (for example because it is only
expected to be received over a different transport).public ChannelAccessMessage decodeMessageToTCPClient(ByteSource byteSource, ChannelAccessVersion version, java.net.Inet4Address serverAddress, int serverPort)
byteSource
- byte source from which the message is read (never
null
). The message is read in an atomic
operation, thus it is either read completely or no data is
read at all, leaving the byte source in its original state.version
- protocol version that shall be used (never null
).
This implementation only supports protocol versions equal to
or greater than ChannelAccessVersion.V4_4
.serverAddress
- IP address of the server that sent the message (never
null
).serverPort
- TCP port of the server that sent the message.null
).java.nio.BufferUnderflowException
- if the byte source does not contain enough data to read the
whole message.MalformedMessageException
- if the message's size is not well aligned.ReceivedMessageTooLargeException
- if the message's payload is larger than the configured
maximum payload receive size.ShortPayloadException
- if the payload size specified in the message's header is too
small considering the message type and the other parameters
in the message's header.UnsupportedMessageTypeException
- if the message type specified in the header is not supported
by this implementation (for example because it is only
expected to be received over a different transport).public ChannelAccessMessage decodeMessageToRepeater(ByteSource byteSource, ChannelAccessVersion version, java.net.Inet4Address originAddress)
byteSource
- byte source from which the message is read (never
null
). The message is read in an atomic
operation, thus it is either read completely or no data is
read at all, leaving the byte source in its original state.version
- protocol version that shall be used (never null
).
This implementation only supports protocol versions equal to
or greater than ChannelAccessVersion.V4_4
.originAddress
- IP address of the host that the message originated from.null
).java.nio.BufferUnderflowException
- if the byte source does not contain enough data to read the
message header.MalformedMessageException
- if the message's size is not well aligned.ReceivedMessageTooLargeException
- if the message's payload is larger than the configured
maximum payload receive size.UnsupportedMessageTypeException
- if the message type specified in the header is not supported
by this implementation (for example because it is only
expected to be received over a different transport).public ChannelAccessMessage decodeMessageFromRepeater(ByteSource byteSource, ChannelAccessVersion version)
byteSource
- byte source from which the message is read (never
null
). The message is read in an atomic
operation, thus it is either read completely or no data is
read at all, leaving the byte source in its original state.version
- protocol version that shall be used (never null
).
This implementation only supports protocol versions equal to
or greater than ChannelAccessVersion.V4_4
.null
).java.nio.BufferUnderflowException
- if the byte source does not contain enough data to read the
message header.MalformedMessageException
- if the message's size is not well aligned.ReceivedMessageTooLargeException
- if the message's payload is larger than the configured
maximum payload receive size.UnsupportedMessageTypeException
- if the message type specified in the header is not supported
by this implementation (for example because it is only
expected to be received over a different transport).public void verifyMessageToUDPServer(ChannelAccessMessage message, ChannelAccessVersion version)
ChannelAccessVersionUDPMessage
and
ChannelAccessSearchClientMessage
can be sent via this protocol.
This verification ensures that
encodeMessageToUDPServer(ByteSink, ChannelAccessMessage, ChannelAccessVersion)
does not throw an exception (except for a BufferOverflowException
).message
- message to be verified.version
- protocol version that shall be used. This implementation only
supports protocol versions equal to or greater than
ChannelAccessVersion.V4_4
.java.lang.IllegalArgumentException
- if this message is of a type that cannot be sent from a
client to a server via UDP.SerializedChannelNameTooLargeException
- if a channel name has to be serialized and the serialized
form of the channel name is too long.SerializedPayloadTooLargeException
- if the message cannot be sent because the payload would be
larger than the configured maximum payload send size or the
specified protocol version is older than Channel Access
version 4.9 and the payload would be larger than 65528 bytes
or the count exceeds 65535 elements.UnsupportedInThisVersionException
- if this message is not support in the protocol version
specified by version
.java.lang.UnsupportedOperationException
- if this message has been constructed by deserializing it from
headers only and thus it is incomplete.UnsupportedProtocolVersionException
- if the specified version
is older than the
oldest supported protocol version for this message. In
general, all Channel Access versions since version 4.4 should
be supported.public void verifyMessageToUDPClient(ChannelAccessMessage message, ChannelAccessVersion version)
ChannelAccessVersionUDPMessage
and
ChannelAccessSearchUDPServerMessage
,
ChannelAccessEchoMessage
, ChannelAccessErrorMessage
, and
ChannelAccessNotFoundMessage
can be sent via this protocol. This
verification ensures that
encodeMessageToUDPClient(ByteSink, ChannelAccessMessage, ChannelAccessVersion)
does not throw an exception (except for a BufferOverflowException
).message
- message to be encoded.version
- protocol version that shall be used. This implementation only
supports protocol versions equal to or greater than
ChannelAccessVersion.V4_4
.java.lang.IllegalArgumentException
- if this message is of a type that cannot be sent from a
server to a client via UDP.SerializedPayloadTooLargeException
- if the message cannot be sent because the payload would be
larger than the configured maximum payload send size or the
specified protocol version is older than Channel Access
version 4.9 and the payload would be larger than 65528 bytes
or the count exceeds 65535 elements.UnsupportedInThisVersionException
- if this message is not support in the protocol version
specified by version
.java.lang.UnsupportedOperationException
- if this message has been constructed by deserializing it from
headers only and thus it is incomplete.UnsupportedProtocolVersionException
- if the specified version
is older than the
oldest supported protocol version for this message. In
general, all Channel Access versions since version 4.4 should
be supported.public void verifyMessageToRepeater(ChannelAccessMessage message, ChannelAccessVersion version)
ChannelAccessBeaconMessage
can be sent via this protocol. This
verification ensures that
encodeMessageToRepeater(ByteSink, ChannelAccessMessage, ChannelAccessVersion)
does not throw an exception (except for a BufferOverflowException
).message
- message to be encoded.version
- protocol version that shall be used. This implementation only
supports protocol versions equal to or greater than
ChannelAccessVersion.V4_4
.java.lang.IllegalArgumentException
- if this message is of a type that cannot be sent to a
repeater.public void verifyMessageFromRepeater(ChannelAccessMessage message, ChannelAccessVersion version)
ChannelAccessVersionUDPMessage
,
ChannelAccessRepeaterConfirmMessage
, and
ChannelAccessBeaconMessage
can be sent via this protocol. This
verification ensures that
encodeMessageFromRepeater(ByteSink, ChannelAccessMessage, ChannelAccessVersion)
does not throw an exception (except for a BufferOverflowException
).message
- message to be encoded.version
- protocol version that shall be used. This implementation only
supports protocol versions equal to or greater than
ChannelAccessVersion.V4_4
.java.lang.IllegalArgumentException
- if this message is of a type that cannot be sent from a
repeater to a client via UDP.public void verifyMessageToTCPServer(ChannelAccessMessage message, ChannelAccessVersion version)
ChannelAccessVersionTCPClientMessage
,
ChannelAccessSubscriptionClientMessage
,
ChannelAccessCancelSubscriptionClientMessage
,
ChannelAccessReadClientMessage
, ChannelAccessWriteMessage
, ChannelAccessEventsOffMessage
,
ChannelAccessEventsOnMessage
,
ChannelAccessReadSyncMessage
,
ChannelAccessDisconnectChannelMessage
,
ChannelAccessReadNotifyClientMessage
,
ChannelAccessConnectChannelClientMessage
,
ChannelAccessWriteNotifyClientMessage
,
ChannelAccessUserNameMessage
,
ChannelAccessHostNameMessage
, ChannelAccessEchoMessage
,
and ChannelAccessSearchClientMessage
can be sent via this
protocol. This verification ensures that
encodeMessageToTCPServer(ByteSink, ChannelAccessMessage, ChannelAccessVersion)
does not throw an exception (except for a BufferOverflowException
).message
- message to be encoded.version
- protocol version that shall be used. This implementation only
supports protocol versions equal to or greater than
ChannelAccessVersion.V4_4
.java.lang.IllegalArgumentException
- if this message is of a type that cannot be sent from a
client to a server via TCP.SerializedPayloadTooLargeException
- if the message cannot be sent because the payload would be
larger than the configured maximum payload send size or the
specified protocol version is older than Channel Access
version 4.9 and the payload would be larger than 65528 bytes
or the count exceeds 65535 elements.UnsupportedInThisVersionException
- if this message is not support in the protocol version
specified by version
.java.lang.UnsupportedOperationException
- if this message has been constructed by deserializing it from
headers only and thus it is incomplete.UnsupportedProtocolVersionException
- if the specified version
is older than the
oldest supported protocol version for this message. In
general, all Channel Access versions since version 4.4 should
be supported.public void verifyMessageToTCPClient(ChannelAccessMessage message, ChannelAccessVersion version)
ChannelAccessVersionTCPServerMessage
,
ChannelAccessSubscriptionServerMessage
,
ChannelAccessCancelSubscriptionServerMessage
,
ChannelAccessReadServerMessage
,
ChannelAccessReadSyncMessage
, ChannelAccessErrorMessage
,
ChannelAccessDisconnectChannelMessage
,
ChannelAccessReadNotifyServerMessage
,
ChannelAccessConnectChannelServerMessage
,
ChannelAccessWriteNotifyServerMessage
,
ChannelAccessAccessRightsMessage
,
ChannelAccessEchoMessage
,
ChannelAccessConnectChannelFailedMessage
,
ChannelAccessChannelDisconnectedByServerMessage
,
ChannelAccessSearchTCPServerMessage
, and
ChannelAccessNotFoundMessage
can be sent via this protocol. This
verification ensures that
encodeMessageToTCPClient(ByteSink, ChannelAccessMessage, ChannelAccessVersion)
does not throw an exception (except for a BufferOverflowException
).message
- message to be encoded.version
- protocol version that shall be used. This implementation only
supports protocol versions equal to or greater than
ChannelAccessVersion.V4_4
.java.lang.IllegalArgumentException
- if this message is of a type that cannot be sent from a
server to a client via TCP.SerializedPayloadTooLargeException
- if the message cannot be sent because the payload would be
larger than the configured maximum payload send size or the
specified protocol version is older than Channel Access
version 4.9 and the payload would be larger than 65528 bytes
or the count exceeds 65535 elements.UnsupportedInThisVersionException
- if this message is not support in the protocol version
specified by version
.java.lang.UnsupportedOperationException
- if this message has been constructed by deserializing it from
headers only and thus it is incomplete.UnsupportedProtocolVersionException
- if the specified version
is older than the
oldest supported protocol version for this message. In
general, all Channel Access versions since version 4.4 should
be supported.Copyright © 2014–2017 aquenos GmbH. All rights reserved.