Class TcpCodecs
java.lang.Object
org.springframework.integration.ip.tcp.serializer.TcpCodecs
public final class TcpCodecs extends Object
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 Type Method Description static 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.static ByteArrayLengthHeaderSerializer
lengthHeader(int bytes)
Return a serializer with the default max message size for deserialization.static ByteArrayLengthHeaderSerializer
lengthHeader1()
Return a serializer with the default max message size for deserialization.static ByteArrayLengthHeaderSerializer
lengthHeader1(int maxMessageSize)
Return a serializer with the provided max message size for deserialization.static ByteArrayLengthHeaderSerializer
lengthHeader2()
Return a serializer with the default max message size for deserialization.static ByteArrayLengthHeaderSerializer
lengthHeader2(int maxMessageSize)
Return a serializer with the provided max message size for deserialization.static ByteArrayLengthHeaderSerializer
lengthHeader4()
Return a serializer with the default max message size for deserialization.static ByteArrayLengthHeaderSerializer
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.static ByteArraySingleTerminatorSerializer
singleTerminator(byte terminator)
Return a serializer with the default max message size for deserialization.static ByteArraySingleTerminatorSerializer
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:
AbstractByteArraySerializer.DEFAULT_MAX_MESSAGE_SIZE
-
lf
Return a serializer with the default max message size for deserialization. 2048.- Returns:
- a
ByteArrayLfSerializer
. - See Also:
AbstractByteArraySerializer.DEFAULT_MAX_MESSAGE_SIZE
-
raw
Return a serializer with the default max message size for deserialization.- Returns:
- a
ByteArrayRawSerializer
. - See Also:
AbstractByteArraySerializer.DEFAULT_MAX_MESSAGE_SIZE
-
stxetx
Return a serializer with the default max message size for deserialization.- Returns:
- a
ByteArrayStxEtxSerializer
. - See Also:
AbstractByteArraySerializer.DEFAULT_MAX_MESSAGE_SIZE
-
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:
AbstractByteArraySerializer.DEFAULT_MAX_MESSAGE_SIZE
-
lengthHeader1
Return a serializer with the default max message size for deserialization.- Returns:
- a
ByteArrayLengthHeaderSerializer
with a 1 byte header. - See Also:
AbstractByteArraySerializer.DEFAULT_MAX_MESSAGE_SIZE
-
lengthHeader2
Return a serializer with the default max message size for deserialization.- Returns:
- a
ByteArrayLengthHeaderSerializer
with a 2 byte header. - See Also:
AbstractByteArraySerializer.DEFAULT_MAX_MESSAGE_SIZE
-
lengthHeader4
Return a serializer with the default max message size for deserialization.- Returns:
- a
ByteArrayLengthHeaderSerializer
with a 4 byte header. - See Also:
AbstractByteArraySerializer.DEFAULT_MAX_MESSAGE_SIZE
-
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:
AbstractByteArraySerializer.DEFAULT_MAX_MESSAGE_SIZE
-
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
-