Class ConvertingBytesMessageMapper
java.lang.Object
org.springframework.integration.mapping.ConvertingBytesMessageMapper
- All Implemented Interfaces:
BytesMessageMapper
,InboundMessageMapper<byte[]>
,OutboundMessageMapper<byte[]>
public class ConvertingBytesMessageMapper extends Object implements BytesMessageMapper
The
BytesMessageMapper
implementation to delegate to/from Message
conversion into the provided MessageConverter
.
The MessageConverter
must not return null
from its
MessageConverter.fromMessage(Message, Class)
and MessageConverter.toMessage(Object, MessageHeaders)
methods.
If MessageConverter.fromMessage(Message, Class)
returns String
, it is converted to byte
using a StandardCharsets.UTF_8
encoding.
- Since:
- 5.4
- Author:
- Artem Bilan
-
Constructor Summary
Constructors Constructor Description ConvertingBytesMessageMapper(MessageConverter messageConverter)
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.integration.mapping.BytesMessageMapper
toMessage
-
Constructor Details
-
Method Details
-
toMessage
Description copied from interface:InboundMessageMapper
Convert a provided object to theMessage
and supply with headers if necessary and provided.- Specified by:
toMessage
in interfaceBytesMessageMapper
- Specified by:
toMessage
in interfaceInboundMessageMapper<byte[]>
- Parameters:
bytes
- the object for message payload or some other conversion logicheaders
- additional headers for building message. Can be null- Returns:
- the message as a result of mapping
-
fromMessage
- Specified by:
fromMessage
in interfaceOutboundMessageMapper<byte[]>
-