public class DefaultMessageBuilder extends Object implements MessageBuilder
MessageBuilder
.Constructor and Description |
---|
DefaultMessageBuilder() |
Modifier and Type | Method and Description |
---|---|
Body |
copy(Body body)
Returns a copy of the given
Body that can be used (and modified)
independently of the original. |
BodyPart |
copy(Entity other)
Creates a new
BodyPart from the specified
Entity . |
Header |
copy(Header other)
Creates a new
Header from the specified
Header . |
Message |
copy(Message other)
Creates a new
Message from the specified
Message . |
Multipart |
copy(Multipart other)
Creates a new
Multipart from the specified
Multipart . |
Header |
newHeader() |
Header |
newHeader(Header source) |
Message |
newMessage() |
Message |
newMessage(Message source) |
Multipart |
newMultipart(Multipart source) |
Multipart |
newMultipart(String subType) |
Header |
parseHeader(InputStream is) |
Message |
parseMessage(InputStream is) |
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 |
setMimeEntityConfig(MimeConfig config) |
public void setFieldParser(FieldParser<? extends ParsedField> fieldParser)
public void setBodyFactory(BodyFactory bodyFactory)
public void setMimeEntityConfig(MimeConfig config)
public void setBodyDescriptorBuilder(BodyDescriptorBuilder bodyDescBuilder)
public void setDecodeMonitor(DecodeMonitor monitor)
public void setContentDecoding(boolean contentDecoding)
public void setFlatMode(boolean flatMode)
public Header copy(Header other)
Header
from the specified
Header
. The Header
instance is initialized
with a copy of the list of Field
s of the specified
Header
. The Field
objects are not copied
because they are immutable and can safely be shared between headers.other
- header to copy.public BodyPart copy(Entity other)
BodyPart
from the specified
Entity
. The BodyPart
instance is initialized
with copies of header and body of the specified Entity
.
The parent entity of the new body part is null
.other
- body part to copy.UnsupportedOperationException
- if other
contains a SingleBody
that
does not support the copy()
operation.IllegalArgumentException
- if other
contains a Body
that
is neither a Message
, Multipart
or
SingleBody
.public Multipart copy(Multipart other)
Multipart
from the specified
Multipart
. The Multipart
instance is
initialized with copies of preamble, epilogue, sub type and the list of
body parts of the specified Multipart
. The parent entity
of the new multipart is null
.other
- multipart to copy.UnsupportedOperationException
- if other
contains a SingleBody
that
does not support the copy()
operation.IllegalArgumentException
- if other
contains a Body
that
is neither a Message
, Multipart
or
SingleBody
.public Body copy(Body body)
Body
that can be used (and modified)
independently of the original. The copy should be
disposed of
when it is no longer needed.
The parent
of the returned copy is
null
, that is, the copy is detached from the parent
entity of the original.
body
- body to copy.UnsupportedOperationException
- if body
is an instance of SingleBody
that does not support the copy()
operation (or contains such a SingleBody
).IllegalArgumentException
- if body
is null
or
body
is a Body
that is neither
a MessageImpl
, Multipart
or SingleBody
(or contains such a Body
).public Message copy(Message other)
Message
from the specified
Message
. The Message
instance is
initialized with copies of header and body of the specified
Message
. The parent entity of the new message is
null
.other
- message to copy.UnsupportedOperationException
- if other
contains a SingleBody
that
does not support the copy()
operation.IllegalArgumentException
- if other
contains a Body
that
is neither a MessageImpl
, Multipart
or
SingleBody
.public Header newHeader()
newHeader
in interface MessageBuilder
public Header newHeader(Header source)
newHeader
in interface MessageBuilder
public Multipart newMultipart(String subType)
newMultipart
in interface MessageBuilder
public Multipart newMultipart(Multipart source)
newMultipart
in interface MessageBuilder
public Header parseHeader(InputStream is) throws IOException, MimeIOException
parseHeader
in interface MessageBuilder
IOException
MimeIOException
public Message newMessage()
newMessage
in interface MessageBuilder
public Message newMessage(Message source)
newMessage
in interface MessageBuilder
public Message parseMessage(InputStream is) throws IOException, MimeIOException
parseMessage
in interface MessageBuilder
IOException
MimeIOException
Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.