MessageContent Class

  • java.lang.Object
    • com.azure.core.models.MessageContent

public class MessageContent

Represents a message with a specific content type and data.

This class encapsulates a message that includes a content type and its corresponding data. The data is represented as a BinaryData object, and the content type is a string.

This class is useful when you want to work with a message that includes a specific type of content and its corresponding data. For example, you can use it to represent a message with JSON data, XML data, or plain text data.

Constructor Summary

Constructor Description
MessageContent()

Creates a new instance of MessageContent.

Method Summary

Modifier and Type Method and Description
BinaryData getBodyAsBinaryData()

Gets the message body.

String getContentType()

Gets the content type.

MessageContent setBodyAsBinaryData(BinaryData binaryData)

Sets the message body.

MessageContent setContentType(String contentType)

Sets the content type.

Methods inherited from java.lang.Object

Constructor Details

MessageContent

public MessageContent()

Creates a new instance of MessageContent.

Method Details

getBodyAsBinaryData

public BinaryData getBodyAsBinaryData()

Gets the message body.

Returns:

The message body.

getContentType

public String getContentType()

Gets the content type.

Returns:

The content type.

setBodyAsBinaryData

public MessageContent setBodyAsBinaryData(BinaryData binaryData)

Sets the message body.

Parameters:

binaryData - The message body.

Returns:

The updated MessageContent object.

setContentType

public MessageContent setContentType(String contentType)

Sets the content type.

Parameters:

contentType - The content type.

Returns:

The updated MessageContent object.

Applies to