Class DefaultMessageBuilder
java.lang.Object
org.apache.james.mime4j.message.DefaultMessageBuilder
- All Implemented Interfaces:
MessageBuilder
Default implementation of
MessageBuilder.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BodyDescriptorBuilderprivate BodyFactoryprivate MimeConfigprivate booleanprivate FieldParser<? extends ParsedField> private booleanprivate MessageImplFactoryprivate DecodeMonitor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a copy of the givenBodythat can be used (and modified) independently of the original.Creates a newBodyPartfrom the specifiedEntity.Creates a newHeaderfrom the specifiedHeader.Creates a newMessagefrom the specifiedMessage.Creates a newMultipartfrom the specifiedMultipart.newMessage(Message source) newMessage(Message.Builder source) private MessageImplnewMultipart(String subType) newMultipart(String subType, NameValuePair... contentTypeParameters) newMultipart(Multipart source) newMultipart(MultipartBuilder source) voidsetBodyDescriptorBuilder(BodyDescriptorBuilder bodyDescBuilder) voidsetBodyFactory(BodyFactory bodyFactory) voidsetContentDecoding(boolean contentDecoding) voidsetDecodeMonitor(DecodeMonitor monitor) voidsetFieldParser(FieldParser<? extends ParsedField> fieldParser) voidsetFlatMode(boolean flatMode) voidsetMessageImplFactory(MessageImplFactory messageImplFactory) voidsetMimeEntityConfig(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 newHeaderfrom the specifiedHeader. TheHeaderinstance is initialized with a copy of the list ofFields of the specifiedHeader. TheFieldobjects are not copied because they are immutable and can safely be shared between headers.- Parameters:
other- header to copy.
-
copy
Creates a newBodyPartfrom the specifiedEntity. TheBodyPartinstance 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- ifothercontains aSingleBodythat does not support thecopy()operation.IllegalArgumentException- ifothercontains aBodythat is neither aMessage,MultipartorSingleBody.
-
copy
Creates a newMultipartfrom the specifiedMultipart. TheMultipartinstance 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- ifothercontains aSingleBodythat does not support thecopy()operation.IllegalArgumentException- ifothercontains aBodythat is neither aMessage,MultipartorSingleBody.
-
copy
Returns a copy of the givenBodythat can be used (and modified) independently of the original. The copy should bedisposed ofwhen it is no longer needed.The
parentof 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- ifbodyis an instance ofSingleBodythat does not support thecopy()operation (or contains such aSingleBody).IllegalArgumentException- ifbodyisnullorbodyis aBodythat is neither aMessageImpl,MultipartorSingleBody(or contains such aBody).
-
copy
Creates a newMessagefrom the specifiedMessage. TheMessageinstance 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- ifothercontains aSingleBodythat does not support thecopy()operation.IllegalArgumentException- ifothercontains aBodythat is neither aMessageImpl,MultipartorSingleBody.
-
newHeader
- Specified by:
newHeaderin interfaceMessageBuilder
-
newHeader
- Specified by:
newHeaderin interfaceMessageBuilder
-
newMultipart
- Specified by:
newMultipartin interfaceMessageBuilder
-
newMultipart
-
newMultipart
- Specified by:
newMultipartin interfaceMessageBuilder
-
parseHeader
- Specified by:
parseHeaderin interfaceMessageBuilder- Throws:
IOExceptionMimeIOException
-
newMessage
- Specified by:
newMessagein interfaceMessageBuilder
-
newMessage
- Specified by:
newMessagein interfaceMessageBuilder
-
parseMessage
- Specified by:
parseMessagein interfaceMessageBuilder- Throws:
IOExceptionMimeIOException
-
newMessageImpl
-
newMultipart
- Specified by:
newMultipartin interfaceMessageBuilder
-
newMessage
- Specified by:
newMessagein interfaceMessageBuilder
-