Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
javax.mail.Message
javax.mail.internet.MimeMessage
gnu.mail.providers.ReadOnlyMessage
public abstract class ReadOnlyMessage
extends MimeMessage
Nested Class Summary |
Field Summary |
Fields inherited from class javax.mail.internet.MimeMessage | |
content , contentStream , dh , flags , headers , modified , saved |
Fields inherited from interface javax.mail.Part | |
ATTACHMENT , INLINE |
Constructor Summary | |
| |
| |
| |
|
Method Summary | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void | |
void |
|
Methods inherited from class javax.mail.Message | |
addFrom , addRecipient , addRecipients , getAllRecipients , getFlags , getFolder , getFrom , getMessageNumber , getReceivedDate , getRecipients , getReplyTo , getSentDate , getSubject , isExpunged , isSet , match , reply , saveChanges , setExpunged , setFlag , setFlags , setFrom , setFrom , setMessageNumber , setRecipient , setRecipients , setReplyTo , setSentDate , setSubject |
protected ReadOnlyMessage(Folder folder, InputStream in, int msgnum) throws MessagingException
Constructs a MimeMessage by reading and parsing the data from the specified MIME InputStream. The InputStream will be left positioned at the end of the data for the message. Note that the input stream parse is done within this constructor itself. This method is for providers subclassing MimeMessage.
- Parameters:
folder
- The containing folder.msgnum
- Message number of this message within its folder
protected ReadOnlyMessage(Folder folder, int msgnum) throws MessagingException
Constructs an empty MimeMessage object with the given Folder and message number. This method is for providers subclassing MimeMessage.
protected ReadOnlyMessage(Folder folder, InternetHeaders headers, byte[] content, int msgnum) throws MessagingException
Constructs a MimeMessage from the given InternetHeaders object and content. This method is for providers subclassing MimeMessage.
- Parameters:
folder
- The containing folder.headers
- The message headers.content
- the content as an array of bytesmsgnum
- Message number of this message within its folder
protected ReadOnlyMessage(MimeMessage message) throws MessagingException
Constructs a new MimeMessage with content initialized from the source MimeMessage. The new message is independent of the original. Note: The current implementation is rather inefficient, copying the data more times than strictly necessary.
- Parameters:
public void addHeader(String name, String value) throws MessagingException
Add this value to the existing values for this header_name. Note that RFC 822 headers must contain only US-ASCII characters, so a header that contains non US-ASCII characters must have been encoded as per the rules of RFC 2047.
- Overrides:
- addHeader in interface MimeMessage
- Parameters:
name
- header namevalue
- header value
public void addHeaderLine(String line) throws MessagingException
Add a raw RFC 822 header-line.
- Specified by:
- addHeaderLine in interface MimePart
- Overrides:
- addHeaderLine in interface MimeMessage
- Parameters:
line
- the line to add
public void removeHeader(String name) throws MessagingException
Remove all headers with this name.
- Specified by:
- removeHeader in interface Part
- Overrides:
- removeHeader in interface MimeMessage
- Parameters:
name
- header name
public void saveChanges() throws MessagingException
Updates the appropriate header fields of this message to be consistent with the message's contents. If this message is contained in a Folder, any changes made to this message are committed to the containing folder. If any part of a message's headers or contents are changed,saveChanges
must be called to ensure that those changes are permanent. Otherwise, any such modifications may or may not be saved, depending on the folder implementation. Messages obtained from folders opened READ_ONLY should not be modified andsaveChanges
should not be called on such messages. This method sets themodified
flag to true, thesave
flag to true, and then calls theupdateHeaders
method.
- Overrides:
- saveChanges in interface MimeMessage
public void setContent(Object o, String type) throws MessagingException
A convenience method for setting this Message's content. The content is wrapped in a DataHandler object. Note that a DataContentHandler class for the specified type should be available to the JavaMail implementation for this to work right. i.e., to dosetContent(foobar, "application/x-foobar")
, a DataContentHandler for "application/x-foobar" should be installed. Refer to the Java Activation Framework for more information.
- Specified by:
- setContent in interface Part
- Overrides:
- setContent in interface MimeMessage
- Parameters:
o
- the content objecttype
- Mime type of the object
- See Also:
MimeBodyPart.setContent
public void setContent(Multipart mp) throws MessagingException
This method sets the Message's content to a Multipart object.
- Specified by:
- setContent in interface Part
- Overrides:
- setContent in interface MimeMessage
- Parameters:
mp
- The multipart object that is the Message's content
- See Also:
MimeBodyPart.setContent(Multipart)
public void setFlags(Flags flag, boolean set) throws MessagingException
Set the flags for this message. This implementation modifies the flags field.
- Overrides:
- setFlags in interface MimeMessage
public void setHeader(String name, String value) throws MessagingException
Set the value for this header_name. Replaces all existing header values with this new value. Note that RFC 822 headers must contain only US-ASCII characters, so a header that contains non US-ASCII characters must have been encoded by the caller as per the rules of RFC 2047.
- Overrides:
- setHeader in interface MimeMessage
- Parameters:
name
- header namevalue
- header value