Java Reference
In-Depth Information
by the Part interface. The only new methods are declared in the MimePart interface, a
subinterface of Part :
public interface MimePart extends Part
Most of these methods are very similar to methods in Part or Message . However, they
have features that are unlikely to be found in non-MIME messages. For instance, a
MIME part may have an MD5 digest, which would be encoded as an extra header inside
the part. Thus, the MimePart interface declares and the MimeMessage class implements
two methods to get and set this digest:
public String getContentMD5 () throws MessagingException
public void setContentMD5 ( String md5 ) throws MessagingException ,
IllegalWriteException , IllegalStateException
The addHeaderLine() method adds a string of text to the header of the message. It's up
to you to make sure that this string will actually make sense in the header:
public void addHeaderLine ( String line ) throws
MessagingException , IllegalWriteException , IllegalStateException
The getHeader() method returns the value of every header in the message with the
given name. If there are multiple headers with this name, the string separates the values
of the different headers with the specified delimiter string:
public String getHeader ( String name , String delimiter )
throws MessagingException
The getAllHeaderLines() method returns a java.util.Enumeration containing
every header in the message. The Enumeration contains String objects, one per header.
Each String contains the full name and value; for example, “Subject: Re: Java 5 support”.
It is not divided into a separate name and value:
public Enumeration getAllHeaderLines () throws MessagingException
The getMatchingHeaderLines() method returns all header lines with names given in
the names argument array. The getNonMatchingHeaderLines() method does the re‐
verse; it returns the header lines with a name not mentioned in the names argument:
public Enumeration getMatchingHeaderLines ( String [] names )
throws MessagingException
public Enumeration getNonMatchingHeaderLines ( String [] names )
throws MessagingException
The getEncoding() method returns the encoding of this MIME part as a String as
given by the Content-transfer-encoding: header. The typical encoding for a plain-text
email is seven-bit or perhaps eight-bit or quoted-printable. The typical encoding for a
file attachment is Base64:
public String getEncoding () throws MessagingException
Search WWH ::




Custom Search