public class MultipartMessageBody extends java.lang.Object implements java.lang.Iterable<MessageBody>
Constructor and Description |
---|
MultipartMessageBody(java.util.List<MessageBody> parts)
Creates a new multipart message body with the given parts and a default content boundary String:
"multipart-content-boundary".
|
MultipartMessageBody(java.util.List<MessageBody> parts,
java.lang.String boundary)
Creates a new multipart message body with the given parts and content boundary String.
|
Modifier and Type | Method and Description |
---|---|
static MultipartMessageBody |
decode(byte[] rawContent,
java.lang.String contentType)
Decodes a message body that has a "multipart" Content-Type as per RFC2046.
|
byte[] |
encode()
Encodes this MultipartMessageBody into a byte array suitable for inclusion in a SIP message body.
|
java.lang.String |
getContentDisposition()
Convenience method, if this MultipartMessageBody only has one part, this method will return a String suitable for
use as a Content-Disposition header of a SIP message bearing this MultipartMessageBody in its message body.
|
java.lang.String |
getContentType()
Returns a String suitable for use as a Content-Type header for a SIP message bearing this MultipartMessageBody
in its message body.
|
MessageBody |
getPart(java.lang.String contentType)
Returns the first part in the multipart message body that has the given content type.
|
java.util.List<MessageBody> |
getPartsList()
Gives access to the list of message body parts contained in this MultipartMessageBody.
|
boolean |
hasContent() |
java.util.Iterator<MessageBody> |
iterator() |
java.lang.String |
toString() |
public MultipartMessageBody(java.util.List<MessageBody> parts)
parts
- The individual content body parts in a listpublic MultipartMessageBody(java.util.List<MessageBody> parts, java.lang.String boundary)
parts
- The individual content body parts in a listboundary
- The boundary String to insert between the individual parts of the multipart content bodypublic java.util.Iterator<MessageBody> iterator()
iterator
in interface java.lang.Iterable<MessageBody>
public java.lang.String toString()
toString
in class java.lang.Object
public MessageBody getPart(java.lang.String contentType)
contentType
- The content type of the desired message body part.public java.util.List<MessageBody> getPartsList()
public java.lang.String getContentType()
public java.lang.String getContentDisposition()
public boolean hasContent()
public byte[] encode()
public static MultipartMessageBody decode(byte[] rawContent, java.lang.String contentType) throws java.io.IOException
rawContent
- the undecoded message body bytescontentType
- the value of the Content-Type header, including parameters.
The boundary parameter must be present for the body
parts to be decoded successfully.MultipartMessageBody
object for accessing the parts separately.java.io.IOException
- if unable to decode the multipart body for any reasonCopyright © OpenCloud. All Rights Reserved.