Attachment Class

public class Attachment extends Resource

Represents a document attachment in the Azure Cosmos DB database service.

Each document may contain zero or more attachemnts. Attachments can be of any MIME type - text, image, binary data. These are stored externally in Azure Blob storage. Attachments are automatically deleted when the parent document is deleted.

Constructor Summary

Constructor Description
Attachment()

Initialize an attachment object.

Attachment(JSONObject jsonObject)

Initialize an attachment object from json object.

Attachment(String source)

Initialize an attachment object from json string.

Method Summary

Modifier and Type Method and Description
String getContentType()

Gets the MIME content type of the attachment.

String getMediaLink()

Gets the media link associated with the attachment content.

void setContentType(String contentType)

Sets the MIME content type of the attachment.

void setMediaLink(String mediaLink)

Sets the media link associated with the attachment content.

Inherited Members

Constructor Details

Attachment

public Attachment()

Initialize an attachment object.

Attachment

public Attachment(JSONObject jsonObject)

Initialize an attachment object from json object.

Parameters:

jsonObject - the json object representation of the Attachment.

Attachment

public Attachment(String source)

Initialize an attachment object from json string.

Parameters:

source - the json string representation of the Attachment.

Method Details

getContentType

public String getContentType()

Gets the MIME content type of the attachment.

Returns:

the content type.

getMediaLink

public String getMediaLink()

Gets the media link associated with the attachment content.

Returns:

the media link.

setContentType

public void setContentType(String contentType)

Sets the MIME content type of the attachment.

Parameters:

contentType - the content type to use.

setMediaLink

public void setMediaLink(String mediaLink)

Sets the media link associated with the attachment content.

Parameters:

mediaLink - the media link to use.

Applies to