org.nhindirect.stagent.mail
Class MimeEntity

java.lang.Object
  extended by javax.mail.BodyPart
      extended by javax.mail.internet.MimeBodyPart
          extended by org.nhindirect.stagent.mail.MimeEntity
All Implemented Interfaces:
javax.mail.internet.MimePart, javax.mail.Part

public class MimeEntity
extends javax.mail.internet.MimeBodyPart

Container for a complete MIME entity. May consist of a complete MIME message or a MIME part of a message.

Author:
Greg Meyer, Umesh Madan

Field Summary
 
Fields inherited from interface javax.mail.Part
ATTACHMENT, INLINE
 
Constructor Summary
MimeEntity()
          Constructs an empty MIME entity.
MimeEntity(java.io.InputStream inStream)
          Constructs a message from input stream containing the entire message.
MimeEntity(javax.mail.internet.InternetHeaders headers, byte[] content)
          Constructs a MimeEntity with the provided headers and message body.
 
Method Summary
 byte[] getContentAsBytes()
          Gets the content (body) of the entity as a byte array.
 boolean isMultiPart()
          Indicates if the entity is MIME multipart entity.
 java.lang.String toString()
           
 void verifyContentType(javax.mail.internet.ContentType expectedType)
          Verifies if the content type of the entity is what is expected.
 void verifyContentType(java.lang.String expectedType)
          Verifies if the content type of the entity is what is expected.
 void verifyTransferEncoding(java.lang.String expectedEncoding)
          Verifies if the transfer encoding of the entity is what is expected.
 
Methods inherited from class javax.mail.internet.MimeBodyPart
addHeader, addHeaderLine, attachFile, attachFile, getAllHeaderLines, getAllHeaders, getContent, getContentID, getContentLanguage, getContentMD5, getContentType, getDataHandler, getDescription, getDisposition, getEncoding, getFileName, getHeader, getHeader, getInputStream, getLineCount, getMatchingHeaderLines, getMatchingHeaders, getNonMatchingHeaderLines, getNonMatchingHeaders, getRawInputStream, getSize, isMimeType, removeHeader, saveFile, saveFile, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDataHandler, setDescription, setDescription, setDisposition, setFileName, setHeader, setText, setText, setText, writeTo
 
Methods inherited from class javax.mail.BodyPart
getParent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MimeEntity

public MimeEntity()
Constructs an empty MIME entity.


MimeEntity

public MimeEntity(javax.mail.internet.InternetHeaders headers,
                  byte[] content)
           throws javax.mail.MessagingException
Constructs a MimeEntity with the provided headers and message body.

Parameters:
headers - Collection of headers to apply to the message.
content - The message's body.
Throws:
javax.mail.MessagingException

MimeEntity

public MimeEntity(java.io.InputStream inStream)
           throws javax.mail.MessagingException
Constructs a message from input stream containing the entire message.

Parameters:
inStream - An input stream containing the entire content (headers and content) of the message.
Throws:
javax.mail.MessagingException
Method Detail

isMultiPart

public boolean isMultiPart()
Indicates if the entity is MIME multipart entity.

Returns:
True if the entity is MIME multipart entity. False otherwise.

verifyContentType

public void verifyContentType(java.lang.String expectedType)
                       throws MimeException
Verifies if the content type of the entity is what is expected.

Parameters:
expectedType - The content type of the entity that is expected.
Throws:
ProtocolException - Thrown if the entity's content type does not match the expected type.
MimeException

verifyContentType

public void verifyContentType(javax.mail.internet.ContentType expectedType)
                       throws MimeException
Verifies if the content type of the entity is what is expected.

Parameters:
expectedType - The content type of the entity that is expected.
Throws:
ProtocolException - Thrown if the entity's content type does not match the expected type.
MimeException

verifyTransferEncoding

public void verifyTransferEncoding(java.lang.String expectedEncoding)
                            throws MimeException
Verifies if the transfer encoding of the entity is what is expected.

Parameters:
expectedEncoding - The transfer encoding of the entity that is expected.
Throws:
ProtocolException - Thrown if the entity's transfer encoding does not match the expected encoding.
MimeException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getContentAsBytes

public byte[] getContentAsBytes()
Gets the content (body) of the entity as a byte array.

Returns:
The content (body) of the entity as a byte array.


Copyright © 2010-2011 HNIN Direct. All Rights Reserved.