ballerina/mime2.0.1
Overview
This module provides a set of APIs to work with messages, which follow the Multipurpose Internet Mail Extensions (MIME) specification as specified in the RFC 2045 standard.
1Entity refers to the header fields and the content of a message or a part of the body in a multipart entity.
Supported multipart types
The module supports multipart/form-data
, multipart/mixed
, multipart/alternative
, multipart/related
, and
multipart/parallel
as multipart content types.
Modify and retrieve the data in an entity
This module provides functions to set and get an entity body from different kinds of message types such as XML, text,
JSON, byte[], and body parts. Headers can be modified through functions such as addHeader()
, setHeader()
,
removeHeader()
, etc.
Handling large files
The entity object method setFileAsEntityBody()
can be used to set large files as the entity body and
is able to read it as a stream using the getByteStream()
function.
Functions
[6]
base64Decode | Decodes a given input with MIME specific Base64 encoding scheme. |
base64DecodeBlob | Decodes a given byte[] using the Base64 encoding scheme. |
base64Encode | Encodes a given input with MIME specific Base64 encoding scheme. |
base64EncodeBlob | Encodes a given byte[] using the Base64 encoding scheme. |
getContentDispositionObject | Given the Content-Disposition as a string, gets the |
getMediaType | Gets the |
Classes
[3]
ContentDisposition | Represents values in |
Entity | Represents the headers and body of a message. |
MediaType | Describes the nature of the data in the body of a MIME entity. |
Constants
[28]
APPLICATION_FORM_URLENCODED | Represents the |
APPLICATION_JSON | Represents the |
APPLICATION_OCTET_STREAM | Represents the |
APPLICATION_PDF | Represents the |
APPLICATION_SOAP_XML | Represents the |
APPLICATION_SVG_XML | Represents the |
APPLICATION_XHTML_XML | Represents the |
APPLICATION_XML | Represents the |
BOUNDARY | Key name for |
CHARSET | Key name for |
CONTENT_DISPOSITION | Represents |
CONTENT_ID | Represents |
CONTENT_LENGTH | Represents |
CONTENT_TYPE | Represents |
DEFAULT_CHARSET | Default charset to be used with MIME encoding and decoding. |
IMAGE_GIF | Represents the |
IMAGE_JPEG | Represents the |
IMAGE_PNG | Represents the |
MULTIPART_ALTERNATIVE | Represents the |
MULTIPART_FORM_DATA | Represents the |
MULTIPART_MIXED | Represents the |
MULTIPART_PARALLEL | Represents the |
MULTIPART_RELATED | Represents the |
START | Key name for |
TEXT_HTML | Represents the |
TEXT_PLAIN | Represents the |
TEXT_XML | Represents the |
TYPE | Key name for |
Errors
[16]
DecodeError | Represents a |
EncodeError | Represents an |
Error | Defines the common error type for the module. |
GenericMimeError | Represents a |
HeaderNotFoundError | Represents a |
HeaderUnavailableError | Represents a |
IdleTimeoutTriggeredError | Represents an |
InvalidContentLengthError | Represents a |
InvalidContentTypeError | Represents an |
InvalidHeaderOperationError | Represents a |
InvalidHeaderParamError | Represents a |
InvalidHeaderValueError | Represents a |
NoContentError | Represents a |
ParserError | Represents a |
SerializationError | Represents a |
SetHeaderError | Represents a |