public class MultipartBuilder
extends java.lang.Object
Multipart builder.| Modifier and Type | Field and Description |
|---|---|
private BodyFactory |
bodyFactory |
private java.util.List<Entity> |
bodyParts |
private java.lang.String |
epilogue |
private java.lang.String |
preamble |
private java.lang.String |
subType |
| Modifier | Constructor and Description |
|---|---|
private |
MultipartBuilder() |
| Modifier and Type | Method and Description |
|---|---|
MultipartBuilder |
addBinaryPart(byte[] bin,
java.lang.String mimeType) |
MultipartBuilder |
addBodyPart(Entity bodyPart)
Adds a body part to the end of the list of body parts.
|
MultipartBuilder |
addBodyPart(Entity bodyPart,
int index)
Inserts a body part at the specified position in the list of body parts.
|
MultipartBuilder |
addTextPart(java.lang.String text,
java.nio.charset.Charset charset) |
Multipart |
build() |
MultipartBuilder |
copy(Multipart other) |
static MultipartBuilder |
create() |
static MultipartBuilder |
create(java.lang.String subType) |
static MultipartBuilder |
createCopy(Multipart other) |
java.util.List<Entity> |
getBodyParts()
Gets the list of body parts.
|
int |
getCount()
Returns the number of body parts.
|
java.lang.String |
getEpilogue()
Returns epilogue.
|
java.lang.String |
getPreamble()
Returns preamble.
|
java.lang.String |
getSubType()
Gets the multipart sub-type.
|
MultipartBuilder |
removeBodyPart(int index)
Removes the body part at the specified position in the list of body
parts.
|
MultipartBuilder |
replaceBodyPart(Entity bodyPart,
int index)
Replaces the body part at the specified position in the list of body
parts with the specified body part.
|
MultipartBuilder |
setEpilogue(java.lang.String epilogue)
Sets the epilogue.
|
MultipartBuilder |
setPreamble(java.lang.String preamble)
Sets the preamble.
|
MultipartBuilder |
setSubType(java.lang.String subType)
Sets the multipart sub-type.
|
MultipartBuilder |
use(BodyFactory bodyFactory) |
private final java.util.List<Entity> bodyParts
private java.lang.String subType
private java.lang.String preamble
private java.lang.String epilogue
private BodyFactory bodyFactory
public static MultipartBuilder create(java.lang.String subType)
public static MultipartBuilder createCopy(Multipart other)
public static MultipartBuilder create()
public MultipartBuilder use(BodyFactory bodyFactory)
public java.lang.String getSubType()
alternative (the
default) or parallel. See RFC 2045 for common sub-types
and their meaning.public MultipartBuilder setSubType(java.lang.String subType)
alternative or
parallel. See RFC 2045 for common sub-types and their
meaning.subType - the sub-type.public int getCount()
Entity objects.public java.util.List<Entity> getBodyParts()
Entity objects.public MultipartBuilder addBodyPart(Entity bodyPart)
bodyPart - the body part.public MultipartBuilder addBodyPart(Entity bodyPart, int index)
bodyPart - the body part.index - index at which the specified body part is to be inserted.public MultipartBuilder removeBodyPart(int index)
index - index of the body part to be removed.public MultipartBuilder replaceBodyPart(Entity bodyPart, int index)
bodyPart - body part to be stored at the specified position.index - index of body part to replace.java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >=
getCount()).public java.lang.String getPreamble()
public MultipartBuilder setPreamble(java.lang.String preamble)
preamble - the preamble.public java.lang.String getEpilogue()
public MultipartBuilder setEpilogue(java.lang.String epilogue)
epilogue - the epilogue.public MultipartBuilder addTextPart(java.lang.String text, java.nio.charset.Charset charset) throws java.io.IOException
java.io.IOExceptionpublic MultipartBuilder addBinaryPart(byte[] bin, java.lang.String mimeType) throws java.io.IOException
java.io.IOExceptionpublic MultipartBuilder copy(Multipart other)
public Multipart build()