org.springframework.integration.ip.tcp.connection
Class TcpMessageMapper
java.lang.Object
org.springframework.integration.ip.tcp.connection.TcpMessageMapper
- All Implemented Interfaces:
- InboundMessageMapper<TcpConnection>, OutboundMessageMapper<java.lang.Object>
public class TcpMessageMapper
- extends java.lang.Object
- implements InboundMessageMapper<TcpConnection>, OutboundMessageMapper<java.lang.Object>
Maps incoming data from a TcpConnection
to a Message
.
If StringToBytes is true (default),
payloads of type String are converted to a byte[] using the supplied
charset (UTF-8 by default).
Inbound messages include headers representing the remote end of the
connection as well as a connection id that can be used by a TcpSender
to correlate which connection to send a reply.
- Since:
- 2.0
- Author:
- Gary Russell
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TcpMessageMapper
public TcpMessageMapper()
toMessage
public Message<java.lang.Object> toMessage(TcpConnection connection)
throws java.lang.Exception
- Specified by:
toMessage
in interface InboundMessageMapper<TcpConnection>
- Throws:
java.lang.Exception
fromMessage
public java.lang.Object fromMessage(Message<?> message)
throws java.lang.Exception
- Specified by:
fromMessage
in interface OutboundMessageMapper<java.lang.Object>
- Throws:
java.lang.Exception
setCharset
public void setCharset(java.lang.String charset)
- Parameters:
charset
- the charset to set
setStringToBytes
public void setStringToBytes(boolean stringToBytes)
- Sets whether outbound String payloads are to be converted
to byte[]. Default is true.
- Parameters:
stringToBytes
-
setApplySequence
public void setApplySequence(boolean applySequence)
- Parameters:
applySequence
- the applySequence to set