|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.james.mime4j.message.Entity org.apache.james.mime4j.message.Message
public class Message
Represents a MIME message. The following code parses a stream into a
Message
object.
Message msg = new Message(new FileInputStream("mime.msg"));
Constructor Summary | |
---|---|
Message()
Creates a new empty Message . |
|
Message(java.io.InputStream is)
Parses the specified MIME message stream into a Message
instance. |
|
Message(java.io.InputStream is,
MimeEntityConfig config)
Parses the specified MIME message stream into a Message
instance using given MimeEntityConfig . |
|
Message(java.io.InputStream is,
MimeEntityConfig config,
StorageProvider storageProvider)
Parses the specified MIME message stream into a Message
instance using given MimeEntityConfig and StorageProvider . |
|
Message(Message other)
Creates a new Message from the specified
Message . |
Method Summary | |
---|---|
void |
createMessageId(java.lang.String hostname)
Creates and sets a new Message-ID header field for this message. |
AddressList |
getBcc()
Returns the value of the Bcc header field of this message as AddressList object or null if it is not
present. |
AddressList |
getCc()
Returns the value of the Cc header field of this message as AddressList object or null if it is not
present. |
java.util.Date |
getDate()
Returns the value of the Date header field of this message as Date object or null if it is not present. |
MailboxList |
getFrom()
Returns the value of the From header field of this message as MailboxList object or null if it is not
present. |
java.lang.String |
getMessageId()
Returns the value of the Message-ID header field of this message or null if it is not present. |
AddressList |
getReplyTo()
Returns the value of the Reply-To header field of this message as AddressList object or null if it is not
present. |
Mailbox |
getSender()
Returns the value of the Sender header field of this message as Mailbox object or null if it is not
present. |
java.lang.String |
getSubject()
Returns the (decoded) value of the Subject header field of this message or null if it is not present. |
AddressList |
getTo()
Returns the value of the To header field of this message as AddressList object or null if it is not
present. |
void |
setBcc(Address... bcc)
Sets the Bcc header field of this message to the specified addresses. |
void |
setBcc(Address bcc)
Sets the Bcc header field of this message to the specified address. |
void |
setBcc(java.util.Collection<Address> bcc)
Sets the Bcc header field of this message to the specified addresses. |
void |
setCc(Address... cc)
Sets the Cc header field of this message to the specified addresses. |
void |
setCc(Address cc)
Sets the Cc header field of this message to the specified address. |
void |
setCc(java.util.Collection<Address> cc)
Sets the Cc header field of this message to the specified addresses. |
void |
setDate(java.util.Date date)
Sets the Date header field for this message. |
void |
setDate(java.util.Date date,
java.util.TimeZone zone)
Sets the Date header field for this message. |
void |
setFrom(java.util.Collection<Mailbox> from)
Sets the From header field of this message to the specified mailbox addresses. |
void |
setFrom(Mailbox... from)
Sets the From header field of this message to the specified mailbox addresses. |
void |
setFrom(Mailbox from)
Sets the From header field of this message to the specified mailbox address. |
void |
setReplyTo(Address... replyTo)
Sets the Reply-To header field of this message to the specified addresses. |
void |
setReplyTo(Address replyTo)
Sets the Reply-To header field of this message to the specified address. |
void |
setReplyTo(java.util.Collection<Address> replyTo)
Sets the Reply-To header field of this message to the specified addresses. |
void |
setSender(Mailbox sender)
Sets the Sender header field of this message to the specified mailbox address. |
void |
setSubject(java.lang.String subject)
Sets the Subject header field for this message. |
void |
setTo(Address... to)
Sets the To header field of this message to the specified addresses. |
void |
setTo(Address to)
Sets the To header field of this message to the specified address. |
void |
setTo(java.util.Collection<Address> to)
Sets the To header field of this message to the specified addresses. |
void |
writeTo(java.io.OutputStream out)
Write the content to the given output stream using the default message writer. |
Methods inherited from class org.apache.james.mime4j.message.Entity |
---|
dispose, getBody, getCharset, getContentTransferEncoding, getDispositionType, getFilename, getHeader, getMimeType, getParent, isMimeType, isMultipart, removeBody, setBody, setBody, setBody, setContentDisposition, setContentDisposition, setContentDisposition, setContentDisposition, setContentTransferEncoding, setFilename, setHeader, setMessage, setMultipart, setMultipart, setParent, setText, setText |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.james.mime4j.message.Body |
---|
getParent, setParent |
Methods inherited from interface org.apache.james.mime4j.message.Disposable |
---|
dispose |
Constructor Detail |
---|
public Message()
Message
.
public Message(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.
java.lang.UnsupportedOperationException
- if other
contains a SingleBody
that
does not support the copy()
operation.
java.lang.IllegalArgumentException
- if other
contains a Body
that
is neither a Message
, Multipart
or
SingleBody
.public Message(java.io.InputStream is) throws java.io.IOException, MimeIOException
Message
instance.
is
- the stream to parse.
java.io.IOException
- on I/O errors.
MimeIOException
- on MIME protocol violations.public Message(java.io.InputStream is, MimeEntityConfig config) throws java.io.IOException, MimeIOException
Message
instance using given MimeEntityConfig
.
is
- the stream to parse.
java.io.IOException
- on I/O errors.
MimeIOException
- on MIME protocol violations.public Message(java.io.InputStream is, MimeEntityConfig config, StorageProvider storageProvider) throws java.io.IOException, MimeIOException
Message
instance using given MimeEntityConfig
and StorageProvider
.
is
- the stream to parse.config
- MimeEntityConfig
to use.storageProvider
- StorageProvider
to use for storing text and binary
message bodies.
java.io.IOException
- on I/O errors.
MimeIOException
- on MIME protocol violations.Method Detail |
---|
public void writeTo(java.io.OutputStream out) throws java.io.IOException
default
message writer.
out
- the output stream to write to.
java.io.IOException
- in case of an I/O errorMessageWriter
public java.lang.String getMessageId()
null
if it is not present.
public void createMessageId(java.lang.String hostname)
Header
is created if this message does not already have
one.
hostname
- host name to be included in the identifier or
null
if no host name should be included.public java.lang.String getSubject()
null
if it is not present.
public void setSubject(java.lang.String subject)
Header
is created if
this message does not already have one.
subject
- subject to set or null
to remove the subject
header field.public java.util.Date getDate()
Date
object or null
if it is not present.
public void setDate(java.util.Date date)
TimeZone
of this host to encode the specified
Date
object into a string.
date
- date to set or null
to remove the date header
field.public void setDate(java.util.Date date, java.util.TimeZone zone)
TimeZone
is used to encode the specified Date
object into a string.
date
- date to set or null
to remove the date header
field.zone
- a time zone.public Mailbox getSender()
Mailbox
object or null
if it is not
present.
public void setSender(Mailbox sender)
sender
- address to set or null
to remove the header
field.public MailboxList getFrom()
MailboxList
object or null
if it is not
present.
public void setFrom(Mailbox from)
from
- address to set or null
to remove the header
field.public void setFrom(Mailbox... from)
from
- addresses to set or null
or no arguments to
remove the header field.public void setFrom(java.util.Collection<Mailbox> from)
from
- addresses to set or null
or an empty collection
to remove the header field.public AddressList getTo()
AddressList
object or null
if it is not
present.
public void setTo(Address to)
to
- address to set or null
to remove the header
field.public void setTo(Address... to)
to
- addresses to set or null
or no arguments to
remove the header field.public void setTo(java.util.Collection<Address> to)
to
- addresses to set or null
or an empty collection
to remove the header field.public AddressList getCc()
AddressList
object or null
if it is not
present.
public void setCc(Address cc)
cc
- address to set or null
to remove the header
field.public void setCc(Address... cc)
cc
- addresses to set or null
or no arguments to
remove the header field.public void setCc(java.util.Collection<Address> cc)
cc
- addresses to set or null
or an empty collection
to remove the header field.public AddressList getBcc()
AddressList
object or null
if it is not
present.
public void setBcc(Address bcc)
bcc
- address to set or null
to remove the header
field.public void setBcc(Address... bcc)
bcc
- addresses to set or null
or no arguments to
remove the header field.public void setBcc(java.util.Collection<Address> bcc)
bcc
- addresses to set or null
or an empty collection
to remove the header field.public AddressList getReplyTo()
AddressList
object or null
if it is not
present.
public void setReplyTo(Address replyTo)
replyTo
- address to set or null
to remove the header
field.public void setReplyTo(Address... replyTo)
replyTo
- addresses to set or null
or no arguments to
remove the header field.public void setReplyTo(java.util.Collection<Address> replyTo)
replyTo
- addresses to set or null
or an empty collection
to remove the header field.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |