MessageContent Class
- java.
lang. Object - com.
azure. core. models. MessageContent
- com.
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 |
---|---|
Binary |
getBodyAsBinaryData()
Gets the message body. |
String |
getContentType()
Gets the content type. |
Message |
setBodyAsBinaryData(BinaryData binaryData)
Sets the message body. |
Message |
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:
getContentType
public String getContentType()
Gets the content type.
Returns:
setBodyAsBinaryData
public MessageContent setBodyAsBinaryData(BinaryData binaryData)
Sets the message body.
Parameters:
Returns:
setContentType
public MessageContent setContentType(String contentType)
Sets the content type.
Parameters:
Returns:
Applies to
Azure SDK for Java