public class BodyPartBuilder extends AbstractEntityBuilder
BodyPart builder.| Constructor and Description |
|---|
BodyPartBuilder() |
| Modifier and Type | Method and Description |
|---|---|
AbstractEntityBuilder |
addField(Field field)
Adds a field to the end of the list of fields.
|
BodyPart |
build() |
static BodyPartBuilder |
create() |
AbstractEntityBuilder |
removeFields(String name)
Removes all
Fields having the specified field name. |
BodyPartBuilder |
setBody(BinaryBody binaryBody)
Sets binaryBody of this message.
|
BodyPartBuilder |
setBody(Body body)
Sets body of this message.
|
BodyPartBuilder |
setBody(byte[] bin,
String mimeType)
Sets binary content of this message with the given MIME type.
|
BodyPartBuilder |
setBody(Message message)
Sets body of this message.
|
BodyPartBuilder |
setBody(Multipart multipart)
Sets body of this message.
|
BodyPartBuilder |
setBody(String text,
Charset charset)
Sets text of this message with the charset.
|
BodyPartBuilder |
setBody(String text,
String subtype,
Charset charset)
Sets text of this message with the given MIME subtype and charset.
|
BodyPartBuilder |
setBody(TextBody textBody)
Sets body of this message.
|
BodyPartBuilder |
setContentDisposition(String dispositionType)
Sets content disposition of this message to the
specified disposition type.
|
BodyPartBuilder |
setContentDisposition(String dispositionType,
String filename)
Sets content disposition of this message to the
specified disposition type and filename.
|
BodyPartBuilder |
setContentDisposition(String dispositionType,
String filename,
long size)
Sets content disposition of this message to the
specified values.
|
BodyPartBuilder |
setContentDisposition(String dispositionType,
String filename,
long size,
Date creationDate,
Date modificationDate,
Date readDate)
Sets content disposition of this message to the
specified values.
|
BodyPartBuilder |
setContentTransferEncoding(String contentTransferEncoding)
Sets transfer encoding of this message.
|
BodyPartBuilder |
setContentType(String mimeType,
NameValuePair... parameters)
Sets transfer encoding of this message.
|
BodyPartBuilder |
setField(Field field)
Sets or replaces a field.
|
BodyPartBuilder |
use(BodyFactory bodyFactory)
Sets
BodyFactory that will be
used to generate message body. |
clearFields, containsField, getBody, getCharset, getContentTransferEncoding, getCreationDate, getDispositionType, getField, getField, getFields, getFields, getFields, getFilename, getMimeType, getModificationDate, getReadDate, getSize, obtainField, setBody, setBody, setBodypublic static BodyPartBuilder create()
public BodyPartBuilder use(BodyFactory bodyFactory)
BodyFactory that will be
used to generate message body.bodyFactory - body factory.public BodyPartBuilder setField(Field field)
AbstractEntityBuilderAbstractEntityBuilder.addField(org.apache.james.mime4j.stream.Field)). Otherwise the
first occurrence of a field with the same name is replaced by the given
field and all further occurrences are removed.setField in class AbstractEntityBuilderfield - the field to set.public AbstractEntityBuilder addField(Field field)
AbstractEntityBuilderaddField in class AbstractEntityBuilderfield - the field to add.public AbstractEntityBuilder removeFields(String name)
AbstractEntityBuilderFields having the specified field name.removeFields in class AbstractEntityBuildername - the field name (e.g. From, Subject).public BodyPartBuilder setContentTransferEncoding(String contentTransferEncoding)
AbstractEntityBuildersetContentTransferEncoding in class AbstractEntityBuildercontentTransferEncoding - transfer encoding to use.public BodyPartBuilder setContentType(String mimeType, NameValuePair... parameters)
AbstractEntityBuildersetContentType in class AbstractEntityBuildermimeType - MIME type of this message
the MIME type to use.parameters - content type parameters to use.public BodyPartBuilder setContentDisposition(String dispositionType)
AbstractEntityBuildersetContentDisposition in class AbstractEntityBuilderdispositionType - disposition type value (usually inline or
attachment).public BodyPartBuilder setContentDisposition(String dispositionType, String filename)
AbstractEntityBuildersetContentDisposition in class AbstractEntityBuilderdispositionType - disposition type value (usually inline or
attachment).filename - filename parameter value or null if the
parameter should not be included.public BodyPartBuilder setContentDisposition(String dispositionType, String filename, long size)
AbstractEntityBuildersetContentDisposition in class AbstractEntityBuilderdispositionType - disposition type value (usually inline or
attachment).filename - filename parameter value or null if the
parameter should not be included.size - size parameter value or -1 if the parameter
should not be included.public BodyPartBuilder setContentDisposition(String dispositionType, String filename, long size, Date creationDate, Date modificationDate, Date readDate)
AbstractEntityBuildersetContentDisposition in class AbstractEntityBuilderdispositionType - disposition type value (usually inline or
attachment).filename - filename parameter value or null if the
parameter should not be included.size - size parameter value or -1 if the parameter
should not be included.creationDate - creation-date parameter value or null if the
parameter should not be included.modificationDate - modification-date parameter value or null if
the parameter should not be included.readDate - read-date parameter value or null if the
parameter should not be included.public BodyPartBuilder setBody(Body body)
AbstractEntityBuilderBody.setBody in class AbstractEntityBuilderbody - the body.public BodyPartBuilder setBody(TextBody textBody)
AbstractEntityBuilderBody.setBody in class AbstractEntityBuildertextBody - the body.public BodyPartBuilder setBody(BinaryBody binaryBody)
AbstractEntityBuilderBody.setBody in class AbstractEntityBuilderbinaryBody - the binaryBody.public BodyPartBuilder setBody(Multipart multipart)
AbstractEntityBuilderMultipart.setBody in class AbstractEntityBuildermultipart - the body.public BodyPartBuilder setBody(Message message)
AbstractEntityBuilderMessage.setBody in class AbstractEntityBuildermessage - the body.public BodyPartBuilder setBody(String text, Charset charset) throws IOException
text - the text.charset - the charset of the text.IOExceptionpublic BodyPartBuilder setBody(String text, String subtype, Charset charset) throws IOException
text - the text.charset - the charset of the text.subtype - the text subtype (e.g. "plain", "html" or
"xml").IOExceptionpublic BodyPartBuilder setBody(byte[] bin, String mimeType) throws IOException
bin - the body.mimeType - the MIME media type of the specified body
("type/subtype").IOExceptionpublic BodyPart build()
Copyright © 2004–2023 The Apache Software Foundation. All rights reserved.