Package org.apache.james.mime4j.message
Class DefaultMessageBuilder
java.lang.Object
org.apache.james.mime4j.message.DefaultMessageBuilder
- All Implemented Interfaces:
MessageBuilder
Default implementation of
MessageBuilder
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BodyDescriptorBuilder
private BodyFactory
private MimeConfig
private boolean
private FieldParser
<? extends ParsedField> private boolean
private MessageImplFactory
private DecodeMonitor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a copy of the givenBody
that can be used (and modified) independently of the original.Creates a newBodyPart
from the specifiedEntity
.Creates a newHeader
from the specifiedHeader
.Creates a newMessage
from the specifiedMessage
.Creates a newMultipart
from the specifiedMultipart
.newMessage
(Message source) newMessage
(Message.Builder source) private MessageImpl
newMultipart
(String subType) newMultipart
(String subType, NameValuePair... contentTypeParameters) newMultipart
(Multipart source) newMultipart
(MultipartBuilder source) void
setBodyDescriptorBuilder
(BodyDescriptorBuilder bodyDescBuilder) void
setBodyFactory
(BodyFactory bodyFactory) void
setContentDecoding
(boolean contentDecoding) void
setDecodeMonitor
(DecodeMonitor monitor) void
setFieldParser
(FieldParser<? extends ParsedField> fieldParser) void
setFlatMode
(boolean flatMode) void
setMessageImplFactory
(MessageImplFactory messageImplFactory) void
setMimeEntityConfig
(MimeConfig config)
-
Field Details
-
fieldParser
-
messageImplFactory
-
bodyFactory
-
config
-
bodyDescBuilder
-
contentDecoding
private boolean contentDecoding -
flatMode
private boolean flatMode -
monitor
-
-
Constructor Details
-
DefaultMessageBuilder
public DefaultMessageBuilder()
-
-
Method Details
-
setFieldParser
-
setMessageImplFactory
-
setBodyFactory
-
setMimeEntityConfig
-
setBodyDescriptorBuilder
-
setDecodeMonitor
-
setContentDecoding
public void setContentDecoding(boolean contentDecoding) -
setFlatMode
public void setFlatMode(boolean flatMode) -
copy
Creates a newHeader
from the specifiedHeader
. TheHeader
instance is initialized with a copy of the list ofField
s of the specifiedHeader
. TheField
objects are not copied because they are immutable and can safely be shared between headers.- Parameters:
other
- header to copy.
-
copy
Creates a newBodyPart
from the specifiedEntity
. TheBodyPart
instance is initialized with copies of header and body of the specifiedEntity
. The parent entity of the new body part isnull
.- Parameters:
other
- body part to copy.- Throws:
UnsupportedOperationException
- ifother
contains aSingleBody
that does not support thecopy()
operation.IllegalArgumentException
- ifother
contains aBody
that is neither aMessage
,Multipart
orSingleBody
.
-
copy
Creates a newMultipart
from the specifiedMultipart
. TheMultipart
instance is initialized with copies of preamble, epilogue, sub type and the list of body parts of the specifiedMultipart
. The parent entity of the new multipart isnull
.- Parameters:
other
- multipart to copy.- Throws:
UnsupportedOperationException
- ifother
contains aSingleBody
that does not support thecopy()
operation.IllegalArgumentException
- ifother
contains aBody
that is neither aMessage
,Multipart
orSingleBody
.
-
copy
Returns a copy of the givenBody
that can be used (and modified) independently of the original. The copy should bedisposed of
when it is no longer needed.The
parent
of the returned copy isnull
, that is, the copy is detached from the parent entity of the original.- Parameters:
body
- body to copy.- Returns:
- a copy of the given body.
- Throws:
UnsupportedOperationException
- ifbody
is an instance ofSingleBody
that does not support thecopy()
operation (or contains such aSingleBody
).IllegalArgumentException
- ifbody
isnull
orbody
is aBody
that is neither aMessageImpl
,Multipart
orSingleBody
(or contains such aBody
).
-
copy
Creates a newMessage
from the specifiedMessage
. TheMessage
instance is initialized with copies of header and body of the specifiedMessage
. The parent entity of the new message isnull
.- Parameters:
other
- message to copy.- Throws:
UnsupportedOperationException
- ifother
contains aSingleBody
that does not support thecopy()
operation.IllegalArgumentException
- ifother
contains aBody
that is neither aMessageImpl
,Multipart
orSingleBody
.
-
newHeader
- Specified by:
newHeader
in interfaceMessageBuilder
-
newHeader
- Specified by:
newHeader
in interfaceMessageBuilder
-
newMultipart
- Specified by:
newMultipart
in interfaceMessageBuilder
-
newMultipart
-
newMultipart
- Specified by:
newMultipart
in interfaceMessageBuilder
-
parseHeader
- Specified by:
parseHeader
in interfaceMessageBuilder
- Throws:
IOException
MimeIOException
-
newMessage
- Specified by:
newMessage
in interfaceMessageBuilder
-
newMessage
- Specified by:
newMessage
in interfaceMessageBuilder
-
parseMessage
- Specified by:
parseMessage
in interfaceMessageBuilder
- Throws:
IOException
MimeIOException
-
newMessageImpl
-
newMultipart
- Specified by:
newMultipart
in interfaceMessageBuilder
-
newMessage
- Specified by:
newMessage
in interfaceMessageBuilder
-