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
Field s 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, setBody
public 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)
AbstractEntityBuilder
AbstractEntityBuilder.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 AbstractEntityBuilder
field
- the field to set.public AbstractEntityBuilder addField(Field field)
AbstractEntityBuilder
addField
in class AbstractEntityBuilder
field
- the field to add.public AbstractEntityBuilder removeFields(String name)
AbstractEntityBuilder
Field
s having the specified field name.removeFields
in class AbstractEntityBuilder
name
- the field name (e.g. From, Subject).public BodyPartBuilder setContentTransferEncoding(String contentTransferEncoding)
AbstractEntityBuilder
setContentTransferEncoding
in class AbstractEntityBuilder
contentTransferEncoding
- transfer encoding to use.public BodyPartBuilder setContentType(String mimeType, NameValuePair... parameters)
AbstractEntityBuilder
setContentType
in class AbstractEntityBuilder
mimeType
- MIME type of this message
the MIME type to use.parameters
- content type parameters to use.public BodyPartBuilder setContentDisposition(String dispositionType)
AbstractEntityBuilder
setContentDisposition
in class AbstractEntityBuilder
dispositionType
- disposition type value (usually inline
or
attachment
).public BodyPartBuilder setContentDisposition(String dispositionType, String filename)
AbstractEntityBuilder
setContentDisposition
in class AbstractEntityBuilder
dispositionType
- 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)
AbstractEntityBuilder
setContentDisposition
in class AbstractEntityBuilder
dispositionType
- 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)
AbstractEntityBuilder
setContentDisposition
in class AbstractEntityBuilder
dispositionType
- 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)
AbstractEntityBuilder
Body
.setBody
in class AbstractEntityBuilder
body
- the body.public BodyPartBuilder setBody(TextBody textBody)
AbstractEntityBuilder
Body
.setBody
in class AbstractEntityBuilder
textBody
- the body.public BodyPartBuilder setBody(BinaryBody binaryBody)
AbstractEntityBuilder
Body
.setBody
in class AbstractEntityBuilder
binaryBody
- the binaryBody.public BodyPartBuilder setBody(Multipart multipart)
AbstractEntityBuilder
Multipart
.setBody
in class AbstractEntityBuilder
multipart
- the body.public BodyPartBuilder setBody(Message message)
AbstractEntityBuilder
Message
.setBody
in class AbstractEntityBuilder
message
- the body.public BodyPartBuilder setBody(String text, Charset charset) throws IOException
text
- the text.charset
- the charset of the text.IOException
public 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").IOException
public BodyPartBuilder setBody(byte[] bin, String mimeType) throws IOException
bin
- the body.mimeType
- the MIME media type of the specified body
("type/subtype").IOException
public BodyPart build()
Copyright © 2004–2023 The Apache Software Foundation. All rights reserved.