Movatterモバイル変換


[0]ホーム

URL:


         


Interface MimePart

All Superinterfaces:
Part
All Known Implementing Classes:
MimeMessage,MimeBodyPart

public interfaceMimePart
extendsPart

The MimePart interface models anEntity as defined by MIME (RFC2045, Section 2.4).

MimePart extends the Part interface to add additional RFC822 and MIME specific semantics and attributes. It provides the base interface for the MimeMessage and MimeBodyPart classes


A note on RFC822 and MIME headers

RFC822 and MIME header fieldsmust contain only US-ASCII characters. If a header contains non US-ASCII characters, it must be encoded as per the rules in RFC 2047. The MimeUtility class provided in this package can be used to to achieve this.

See Also:
MimeUtility,Part

Fields inherited from interface javax.mail.Part
ATTACHMENT,INLINE
 
addHeaderLine(java.lang.String line)
          Add a raw RFC822 header-line.
getAllHeaderLines()
          Get all header lines as an Enumeration of Strings.
getContentID()
          Get the Content-ID of this part.
getContentLanguage()
          Get the language tags specified in the Content-Language header of this MimePart.
getContentMD5()
          Get the Content-MD5 digest of this part.
getEncoding()
          Get the transfer encoding of this part.
getHeader(java.lang.String header_name, java.lang.String delimiter)
          Get the values of all header fields available for this header, returned as a single String, with the values separated by the delimiter.
getMatchingHeaderLines(java.lang.String[] names)
          Get matching header lines as an Enumeration of Strings.
getNonMatchingHeaderLines(java.lang.String[] names)
          Get non-matching header lines as an Enumeration of Strings.
setContentLanguage(java.lang.String[] languages)
          Set the Content-Language header of this MimePart.
setContentMD5(java.lang.String md5)
          Set the Content-MD5 of this part.
setText(java.lang.String text)
          Convenience method that sets the given String as this part's content, with a MIME type of "text/plain".
setText(java.lang.String text, java.lang.String charset)
          Convenience method that sets the given String as this part's content, with a MIME type of "text/plain" and the specified charset.
 
Methods inherited from interface javax.mail.Part
addHeader,getAllHeaders,getContent,getContentType,getDataHandler,getDescription,getDisposition,getFileName,getHeader,getInputStream,getLineCount,getMatchingHeaders,getNonMatchingHeaders,getSize,isMimeType,removeHeader,setContent,setContent,setDataHandler,setDescription,setDisposition,setFileName,setHeader,writeTo
 

getHeader

public java.lang.StringgetHeader(java.lang.String header_name,                                  java.lang.String delimiter)                           throwsMessagingException
Get the values of all header fields available for this header, returned as a single String, with the values separated by the delimiter. If the delimiter isnull, only the first value is returned.
Parameters:
header_name - the name of this header
Returns:
the value fields for all headers with this name
Throws:
MessagingException -  

addHeaderLine

public voidaddHeaderLine(java.lang.String line)                   throwsMessagingException
Add a raw RFC822 header-line.
Throws:
IllegalWriteException - if the underlyingimplementation does not support modification
java.lang.IllegalStateException - if this Part isobtained from a READ_ONLY folder

getAllHeaderLines

public java.util.EnumerationgetAllHeaderLines()                                        throwsMessagingException
Get all header lines as an Enumeration of Strings. A Header line is a raw RFC822 header-line, containing both the "name" and "value" field.

getMatchingHeaderLines

public java.util.EnumerationgetMatchingHeaderLines(java.lang.String[] names)                                             throwsMessagingException
Get matching header lines as an Enumeration of Strings. A Header line is a raw RFC822 header-line, containing both the "name" and "value" field.

getNonMatchingHeaderLines

public java.util.EnumerationgetNonMatchingHeaderLines(java.lang.String[] names)                                                throwsMessagingException
Get non-matching header lines as an Enumeration of Strings. A Header line is a raw RFC822 header-line, containing both the "name" and "value" field.

getEncoding

public java.lang.StringgetEncoding()                             throwsMessagingException
Get the transfer encoding of this part.
Returns:
content-transfer-encoding
Throws:
MessagingException -  

getContentID

public java.lang.StringgetContentID()                              throwsMessagingException
Get the Content-ID of this part. Returns null if none present.
Returns:
content-ID

getContentMD5

public java.lang.StringgetContentMD5()                               throwsMessagingException
Get the Content-MD5 digest of this part. Returns null if none present.
Returns:
content-MD5

setContentMD5

public voidsetContentMD5(java.lang.String md5)                   throwsMessagingException
Set the Content-MD5 of this part.
Parameters:
cid - content-id
Throws:
IllegalWriteException - if the underlyingimplementation does not support modification
java.lang.IllegalStateException - if this Part isobtained from a READ_ONLY folder

getContentLanguage

public java.lang.String[]getContentLanguage()                                      throwsMessagingException
Get the language tags specified in the Content-Language header of this MimePart. The Content-Language header is defined by RFC 1766. Returnsnull if this header is not available.

setContentLanguage

public voidsetContentLanguage(java.lang.String[] languages)                        throwsMessagingException
Set the Content-Language header of this MimePart. The Content-Language header is defined by RFC1766.
Parameters:
languages - array of language tags
Throws:
IllegalWriteException - if the underlyingimplementation does not support modification
java.lang.IllegalStateException - if this Part isobtained from a READ_ONLY folder

setText

public voidsetText(java.lang.String text)             throwsMessagingException
Convenience method that sets the given String as this part's content, with a MIME type of "text/plain". If the string contains non US-ASCII characters. it will be encoded using the platform's default charset. The charset is also used to set the "charset" parameter.

Note that there may be a performance penalty iftext is large, since this method may have to scan all the characters to determine what charset to use.

If the charset is already known, use the setText() version that takes the charset parameter.

Specified by:
setText in interfacePart
See Also:
setText(String text, String charset)

setText

public voidsetText(java.lang.String text,                    java.lang.String charset)             throwsMessagingException
Convenience method that sets the given String as this part's content, with a MIME type of "text/plain" and the specified charset. The given Unicode string will be charset-encoded using the specified charset. The charset is also used to set "charset" parameter.

         


[8]ページ先頭

©2009-2025 Movatter.jp