Spring Integration

org.springframework.integration.ip.tcp.connection
Class TcpMessageMapper

java.lang.Object
  extended by 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

Constructor Summary
TcpMessageMapper()
           
 
Method Summary
 java.lang.Object fromMessage(Message<?> message)
           
 void setApplySequence(boolean applySequence)
           
 void setCharset(java.lang.String charset)
           
 void setStringToBytes(boolean stringToBytes)
          Sets whether outbound String payloads are to be converted to byte[].
 Message<java.lang.Object> toMessage(TcpConnection connection)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TcpMessageMapper

public TcpMessageMapper()
Method Detail

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

Spring Integration