Top Description Fields Constructors Methods
org.springframework.messaging.converter

public Class ByteArrayMessageConverter

extends AbstractMessageConverter
Class Inheritance
Imports
org.springframework.lang.Nullable, org.springframework.messaging.Message, .MessageHeaders, org.springframework.util.MimeTypeUtils

A MessageConverter that supports MIME type "application/octet-stream" with the payload converted to and from a byte[].
Author
Rossen Stoyanchev
Since
4.0

Field Summary

Inherited from org.springframework.messaging.converter.AbstractMessageConverter:
logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected Object
convertFromInternal(Message<?>
the input message
message
,
Class<?>
the target class for the conversion
targetClass
,
Object
an extra object passed to the MessageConverter, e.g. the associated MethodParameter (may be null}
conversionHint
)

Overrides org.springframework.messaging.converter.AbstractMessageConverter.convertFromInternal.

Convert the message payload from serialized form to an Object.

protected Object
convertToInternal(Object
the Object to convert
payload
,
MessageHeaders
optional headers for the message (may be null)
headers
,
Object
an extra object passed to the MessageConverter, e.g. the associated MethodParameter (may be null}
conversionHint
)

Overrides org.springframework.messaging.converter.AbstractMessageConverter.convertToInternal.

Convert the payload object to serialized form.

protected boolean
supports(Class<?>
the class to test for support
clazz
)

Implements abstract org.springframework.messaging.converter.AbstractMessageConverter.supports.

Whether the given class is supported by this converter.

Inherited from org.springframework.messaging.converter.AbstractMessageConverter:
addSupportedMimeTypescanConvertFromcanConvertTofromMessagefromMessagegetContentTypeResolvergetDefaultContentTypegetMimeTypegetResolvedTypegetSerializedPayloadClassgetSupportedMimeTypesisStrictContentTypeMatchsetContentTypeResolversetSerializedPayloadClasssetStrictContentTypeMatchsupportsMimeTypetoMessagetoMessage

Constructor Detail

ByteArrayMessageConverterback to summary
public ByteArrayMessageConverter()

Method Detail

convertFromInternalback to summary
protected Object convertFromInternal(Message<?> message, Class<?> targetClass, Object conversionHint)

Overrides org.springframework.messaging.converter.AbstractMessageConverter.convertFromInternal.

Doc from org.springframework.messaging.converter.AbstractMessageConverter.convertFromInternal.

Convert the message payload from serialized form to an Object.

Parameters
message:Message<?>

the input message

targetClass:Class<?>

the target class for the conversion

conversionHint:Object

an extra object passed to the MessageConverter, e.g. the associated MethodParameter (may be null}

Returns:Object

the result of the conversion, or null if the converter cannot perform the conversion

Annotations
@Override
@Nullable
convertToInternalback to summary
protected Object convertToInternal(Object payload, MessageHeaders headers, Object conversionHint)

Overrides org.springframework.messaging.converter.AbstractMessageConverter.convertToInternal.

Doc from org.springframework.messaging.converter.AbstractMessageConverter.convertToInternal.

Convert the payload object to serialized form.

Parameters
payload:Object

the Object to convert

headers:MessageHeaders

optional headers for the message (may be null)

conversionHint:Object

an extra object passed to the MessageConverter, e.g. the associated MethodParameter (may be null}

Returns:Object

the resulting payload for the message, or null if the converter cannot perform the conversion

Annotations
@Override
@Nullable
supportsback to summary
protected boolean supports(Class<?> clazz)

Implements abstract org.springframework.messaging.converter.AbstractMessageConverter.supports.

Doc from org.springframework.messaging.converter.AbstractMessageConverter.supports.

Whether the given class is supported by this converter.

Parameters
clazz:Class<?>

the class to test for support

Returns:boolean

true if supported; false otherwise

Annotations
@Override