Class TcpCodecs
java.lang.Object
org.springframework.integration.ip.tcp.serializer.TcpCodecs
Factory class to create TCP Serializer/Deserializers used to
encode/decode messages to/from a TCP stream.
This is used to simplify configuration with Java, such as
TcpNetServerConnectionFactory server = new TcpNetServerConnectionFactory(1234); server.setSerializer(TcpCodecs.lf()); server.setDeserializer(TcpCodecs.lf()); ...
- Since:
- 5.0
- Author:
- Gary Russell
-
Method Summary
Modifier and TypeMethodDescriptionstatic ByteArrayCrLfSerializer
crlf()
Return a serializer with the default max message size for deserialization.static ByteArrayCrLfSerializer
crlf
(int maxMessageSize) Return a serializer with the provided max message size for deserialization.lengthHeader
(int bytes) Return a serializer with the default max message size for deserialization.Return a serializer with the default max message size for deserialization.lengthHeader1
(int maxMessageSize) Return a serializer with the provided max message size for deserialization.Return a serializer with the default max message size for deserialization.lengthHeader2
(int maxMessageSize) Return a serializer with the provided max message size for deserialization.Return a serializer with the default max message size for deserialization.lengthHeader4
(int maxMessageSize) Return a serializer with the provided max message size for deserialization.static ByteArrayLfSerializer
lf()
Return a serializer with the default max message size for deserialization.static ByteArrayLfSerializer
lf
(int maxMessageSize) Return a serializer with the provided max message size for deserialization.static ByteArrayRawSerializer
raw()
Return a serializer with the default max message size for deserialization.static ByteArrayRawSerializer
raw
(int maxMessageSize) Return a serializer with the provided max message size for deserialization.singleTerminator
(byte terminator) Return a serializer with the default max message size for deserialization.singleTerminator
(byte terminator, int maxMessageSize) Return a serializer with the provided max message size for deserialization.static ByteArrayStxEtxSerializer
stxetx()
Return a serializer with the default max message size for deserialization.static ByteArrayStxEtxSerializer
stxetx
(int maxMessageSize) Return a serializer with the provided max message size for deserialization.
-
Method Details
-
crlf
Return a serializer with the default max message size for deserialization.- Returns:
- a
ByteArrayCrLfSerializer
. - See Also:
-
lf
Return a serializer with the default max message size for deserialization. 2048.- Returns:
- a
ByteArrayLfSerializer
. - See Also:
-
raw
Return a serializer with the default max message size for deserialization.- Returns:
- a
ByteArrayRawSerializer
. - See Also:
-
stxetx
Return a serializer with the default max message size for deserialization.- Returns:
- a
ByteArrayStxEtxSerializer
. - See Also:
-
singleTerminator
Return a serializer with the default max message size for deserialization.- Parameters:
terminator
- the terminator indicating message end.- Returns:
- a
ByteArraySingleTerminatorSerializer
using the supplied terminator. - See Also:
-
lengthHeader1
Return a serializer with the default max message size for deserialization.- Returns:
- a
ByteArrayLengthHeaderSerializer
with a 1 byte header. - See Also:
-
lengthHeader2
Return a serializer with the default max message size for deserialization.- Returns:
- a
ByteArrayLengthHeaderSerializer
with a 2 byte header. - See Also:
-
lengthHeader4
Return a serializer with the default max message size for deserialization.- Returns:
- a
ByteArrayLengthHeaderSerializer
with a 4 byte header. - See Also:
-
lengthHeader
Return a serializer with the default max message size for deserialization.- Parameters:
bytes
- header length.- Returns:
- a
ByteArrayLengthHeaderSerializer
with a 1, 2 or 4 byte header. - See Also:
-
crlf
Return a serializer with the provided max message size for deserialization.- Parameters:
maxMessageSize
- the max message size.- Returns:
- a
ByteArrayCrLfSerializer
. - Since:
- 5.1.3
-
lf
Return a serializer with the provided max message size for deserialization.- Parameters:
maxMessageSize
- the max message size.- Returns:
- a
ByteArrayLfSerializer
. - Since:
- 5.1.3
-
raw
Return a serializer with the provided max message size for deserialization.- Parameters:
maxMessageSize
- the max message size.- Returns:
- a
ByteArrayRawSerializer
. - Since:
- 5.1.3
-
stxetx
Return a serializer with the provided max message size for deserialization.- Parameters:
maxMessageSize
- the max message size.- Returns:
- a
ByteArrayStxEtxSerializer
. - Since:
- 5.1.3
-
singleTerminator
public static ByteArraySingleTerminatorSerializer singleTerminator(byte terminator, int maxMessageSize) Return a serializer with the provided max message size for deserialization.- Parameters:
terminator
- the terminator indicating message end.maxMessageSize
- the max message size.- Returns:
- a
ByteArraySingleTerminatorSerializer
using the supplied terminator. - Since:
- 5.1.3
-
lengthHeader1
Return a serializer with the provided max message size for deserialization.- Parameters:
maxMessageSize
- the max message size.- Returns:
- a
ByteArrayLengthHeaderSerializer
with a 1 byte header. - Since:
- 5.1.3
-
lengthHeader2
Return a serializer with the provided max message size for deserialization.- Parameters:
maxMessageSize
- the max message size.- Returns:
- a
ByteArrayLengthHeaderSerializer
with a 2 byte header. - Since:
- 5.1.3
-
lengthHeader4
Return a serializer with the provided max message size for deserialization.- Parameters:
maxMessageSize
- the max message size.- Returns:
- a
ByteArrayLengthHeaderSerializer
with a 4 byte header. - Since:
- 5.1.3
-