org.springframework.integration.ip.tcp.connection
Class TcpMessageMapper
java.lang.Object
org.springframework.integration.ip.tcp.connection.TcpMessageMapper
- All Implemented Interfaces:
- InboundMessageMapper<TcpConnection>, OutboundMessageMapper<Object>
public class TcpMessageMapper
- extends Object
- implements InboundMessageMapper<TcpConnection>, OutboundMessageMapper<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<Object> toMessage(TcpConnection connection)
throws Exception
- Specified by:
toMessage
in interface InboundMessageMapper<TcpConnection>
- Throws:
Exception
fromMessage
public Object fromMessage(Message<?> message)
throws Exception
- Specified by:
fromMessage
in interface OutboundMessageMapper<Object>
- Throws:
Exception
setCharset
public void setCharset(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
-
Copyright © 2010. All Rights Reserved.