org.YoUmail.maildir
Class MaildirMessage

java.lang.Object
  extended byjavax.mail.Message
      extended byjavax.mail.internet.MimeMessage
          extended byorg.YoUmail.maildir.MaildirMessage
All Implemented Interfaces:
javax.mail.internet.MimePart, javax.mail.Part

public final class MaildirMessage
extends javax.mail.internet.MimeMessage

The message class implementing the Maildir mail protocol.

Author:
Chris Burdess,modified by topmint

Nested Class Summary
 
Nested classes inherited from class javax.mail.internet.MimeMessage
javax.mail.internet.MimeMessage.RecipientType
 
Field Summary
private  java.io.File file
          The file this message is stored in.
private  boolean hasAttachment
          是否有附件
(package private) static java.lang.String PASSED
          The "passed" info flag.
(package private)  java.lang.String uniq
          The unique name of this message.
 
Fields inherited from class javax.mail.internet.MimeMessage
content, contentStream, dh, flags, headers, modified, saved
 
Fields inherited from class javax.mail.Message
expunged, folder, msgnum, session
 
Fields inherited from interface javax.mail.Part
ATTACHMENT, INLINE
 
Constructor Summary
(package private) MaildirMessage(MaildirFolder folder, java.io.File file, java.lang.String uniq, java.lang.String info, int msgnum)
          Creates a Maildir message.
(package private) MaildirMessage(MaildirFolder folder, javax.mail.internet.MimeMessage message, int msgnum)
          Creates a Maildir message.
 
Method Summary
 void delete()
          删除此邮件
 boolean equals(java.lang.Object other)
           
(package private)  void fetch()
          Reads the entire message from the underlying file.
(package private)  void fetchHeaders()
          Reads the message headers from the underlying file.
 java.util.Enumeration getAllHeaderLines()
           
 java.util.Enumeration getAllHeaders()
           
protected  java.io.InputStream getContentStream()
           
 javax.activation.DataHandler getDataHandler()
           
 java.io.File getFile()
          返回此邮件实际文件
 java.lang.String[] getHeader(java.lang.String name)
           
 java.lang.String getHeader(java.lang.String name, java.lang.String delimiter)
           
(package private)  java.lang.String getInfo()
          Returns an info field based on the current flags.
(package private) static java.lang.String getInfo(javax.mail.Flags flags)
           
 java.util.Enumeration getMatchingHeaderLines(java.lang.String[] names)
           
 java.util.Enumeration getMatchingHeaders(java.lang.String[] names)
           
 java.lang.String getMessageID()
          以文件名的MD5值为此信件的ID
 java.util.Enumeration getNonMatchingHeaderLines(java.lang.String[] names)
           
 java.util.Enumeration getNonMatchingHeaders(java.lang.String[] names)
           
 int getSize()
          返回邮件的大小
(package private)  java.lang.String getUniq()
          Returns the unique name of this message.
 boolean hasAttachment()
          是否有附件
 void hasAttachment(boolean has)
          设置是否有附件
protected  void setExpunged(boolean expunged)
          Allow MaildirFolder access to set the expunged flag after expunge.
 void setFlags(javax.mail.Flags flag, boolean set)
          Set the specified flags (reflected in the info field).
 
Methods inherited from class javax.mail.internet.MimeMessage
addFrom, addHeader, addHeaderLine, addRecipients, addRecipients, createInternetHeaders, getAllRecipients, getContent, getContentID, getContentLanguage, getContentMD5, getContentType, getDescription, getDisposition, getEncoding, getFileName, getFlags, getFrom, getInputStream, getLineCount, getRawInputStream, getReceivedDate, getRecipients, getReplyTo, getSentDate, getSubject, isMimeType, isSet, parse, removeHeader, reply, saveChanges, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDataHandler, setDescription, setDescription, setDisposition, setFileName, setFrom, setFrom, setHeader, setRecipients, setRecipients, setReplyTo, setSentDate, setSubject, setSubject, setText, setText, updateHeaders, writeTo, writeTo
 
Methods inherited from class javax.mail.Message
addRecipient, getFolder, getMessageNumber, isExpunged, match, setFlag, setMessageNumber, setRecipient
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PASSED

static final java.lang.String PASSED
The "passed" info flag.

See Also:
Constant Field Values

file

private java.io.File file
The file this message is stored in.


uniq

java.lang.String uniq
The unique name of this message.


hasAttachment

private boolean hasAttachment
是否有附件

Constructor Detail

MaildirMessage

MaildirMessage(MaildirFolder folder,
               java.io.File file,
               java.lang.String uniq,
               java.lang.String info,
               int msgnum)
Creates a Maildir message. This is called by the MaildirFolder.


MaildirMessage

MaildirMessage(MaildirFolder folder,
               javax.mail.internet.MimeMessage message,
               int msgnum)
         throws javax.mail.MessagingException
Creates a Maildir message. This is called by the MaildirFolder when appending. It creates a copy of the specified message for the new folder.

Method Detail

setExpunged

protected void setExpunged(boolean expunged)
Allow MaildirFolder access to set the expunged flag after expunge.


setFlags

public void setFlags(javax.mail.Flags flag,
                     boolean set)
              throws javax.mail.MessagingException
Set the specified flags (reflected in the info field).

Throws:
javax.mail.MessagingException

getUniq

java.lang.String getUniq()
Returns the unique name of this message.


getInfo

java.lang.String getInfo()
Returns an info field based on the current flags.


getInfo

static java.lang.String getInfo(javax.mail.Flags flags)

fetchHeaders

void fetchHeaders()
            throws javax.mail.MessagingException
Reads the message headers from the underlying file.

Throws:
javax.mail.MessagingException

fetch

void fetch()
     throws javax.mail.MessagingException
Reads the entire message from the underlying file.

Throws:
javax.mail.MessagingException

getHeader

public java.lang.String[] getHeader(java.lang.String name)
                             throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

getHeader

public java.lang.String getHeader(java.lang.String name,
                                  java.lang.String delimiter)
                           throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

getAllHeaders

public java.util.Enumeration getAllHeaders()
                                    throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

getAllHeaderLines

public java.util.Enumeration getAllHeaderLines()
                                        throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

getMatchingHeaders

public java.util.Enumeration getMatchingHeaders(java.lang.String[] names)
                                         throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

getMatchingHeaderLines

public java.util.Enumeration getMatchingHeaderLines(java.lang.String[] names)
                                             throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

getNonMatchingHeaders

public java.util.Enumeration getNonMatchingHeaders(java.lang.String[] names)
                                            throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

getNonMatchingHeaderLines

public java.util.Enumeration getNonMatchingHeaderLines(java.lang.String[] names)
                                                throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

getDataHandler

public javax.activation.DataHandler getDataHandler()
                                            throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

getContentStream

protected java.io.InputStream getContentStream()
                                        throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

equals

public boolean equals(java.lang.Object other)

hasAttachment

public boolean hasAttachment()
是否有附件

Returns:
是否有附件

hasAttachment

public void hasAttachment(boolean has)
设置是否有附件

Parameters:
has -

getMessageID

public java.lang.String getMessageID()
以文件名的MD5值为此信件的ID

Returns:
ID

getSize

public int getSize()
返回邮件的大小

Returns:
邮件大小

delete

public void delete()
删除此邮件


getFile

public java.io.File getFile()
返回此邮件实际文件

Returns:
邮件文件