Class GIT.GVU.IMAP.BodyPart
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class GIT.GVU.IMAP.BodyPart

java.lang.Object
   |
   +----GIT.GVU.IMAP.BodyPart

public class BodyPart
extends Object
Class to hold the information about a single part of an email message. A message with multiple parts (i.e. attachments) will have multiple BodyParts.

Method Index

 o FETCH()
Grab the data for this part from the server via the FETCH message.
 o PARTIAL(int, int)
This call is identical to the FETCH() command but only grabs part of the data.
 o getAttributes()
Get a vector of attributes about the body part.
 o getData()
Retreive the text of this body part as a string.
 o getDescription()
Get the descriptive string about this bodypart.
 o getEmbeddedMessage()
This function gets the Message object that is embedded in this object, if it has one.
 o getEncoding()
Get the encoding of this body part.
 o getFirstChild()
Get the first child of this BodyPart.
 o getIdentifier()
Get the MIME identifier of this body part.
 o getMIMESubType()
Get the MIME subtype of this message as a string.
 o getMIMEType()
Get the MIME type of this message as a string.
 o getNextSibling()
Get the next sibling of this body part.
 o getPartNumber()
Gets the IMAP part number of a message.

Methods

 o getFirstChild
  public BodyPart getFirstChild()
Get the first child of this BodyPart. Note: If this part has no children (i.e. its not a multipart or message type) this func returns null.
Returns:
first child of this message (BodyPart)
 o getNextSibling
  public BodyPart getNextSibling()
Get the next sibling of this body part. This (obviously) will return no if the message has no siblings OR if this message is the last of a set of siblings.
Returns:
next sibling of this message (BodyPart)
 o getMIMEType
  public String getMIMEType()
Get the MIME type of this message as a string.
Returns:
a string with the MIME type of this message
 o getMIMESubType
  public String getMIMESubType()
Get the MIME subtype of this message as a string.
Returns:
a string with the MIME subtype of this message
 o getAttributes
  public Vector getAttributes()
Get a vector of attributes about the body part. Note: This might be null if none were supplied. Generally, this is going to have at least the pair CHARSET . The contents of this vector are strings in Attribute, Value order (i.e. evens are names of attributes, odds are their values).
Returns:
a vector of strings which is attribute-value pairs about this message
 o getIdentifier
  public String getIdentifier()
Get the MIME identifier of this body part. If none was supplied, this might be null.
Returns:
a string with this messages MIME identifier or null
 o getDescription
  public String getDescription()
Get the descriptive string about this bodypart. Note: Might be null.
Returns:
a string with a description of this body part (or null)
 o getEncoding
  public String getEncoding()
Get the encoding of this body part. XXX This should probably be an enumeration but it returns a string XXX Note: The multipart body part of a multipart message has no encoding.
Returns:
a string with the encoding type of this body part
 o FETCH
  public boolean FETCH() throws IMAPException, InternalErr
Grab the data for this part from the server via the FETCH message. Note this is a call to "FETCH n BODY[p]" where n is the message number and p is the part number. Also note that this is cached, so repeated calls to this method have no effect after the first one. Thus, don't hesitate to call this before calling getData(). Also note: this call modifies the \Seen flag on the message if its not already set via nowSeen().
Returns:
true if this succeeded, false otherwise
Throws: IMAPException
is propagated
Throws: InternalErr
is propagated
 o PARTIAL
  public boolean PARTIAL(int first,
                         int num) throws InternalErr, IMAPException
This call is identical to the FETCH() command but only grabs part of the data. It resets this body parts data to be the result of this command. Thus, to get all the data, you must issue multiple calls to PARTIAL and getData(). This command would be a good idea if you think (look at getSize()!) the data you are going to retreive is very large. Using PARTIAL you can get it in pieces. Note: if you need to base64 decode this data, be sure you don't end up calling decodeUnit() with a number of bytes that is not a multiple of 4!
Parameters:
int - first offset of first byte to retreive
int - num number of bytes to retreive
Returns:
true if the PARTIAL command was successful.
Throws: IMAPException
is propagated
Throws: InternalErr
is propagated
 o getPartNumber
  public String getPartNumber()
Gets the IMAP part number of a message. Probably only useful for people working on the protocol level. MULITPART and MESSAGE/RFC822 have no part number.
Returns:
String with the printed form of the message's part number
 o getEmbeddedMessage
  public Message getEmbeddedMessage()
This function gets the Message object that is embedded in this object, if it has one. This will be null if this BodyPart is not of type MESSAGE and subtype RFC822.
Returns:
a Message that is held by this body part or null.
 o getData
  public String getData()
Retreive the text of this body part as a string. Note: This information is cached, so retreiving it repeatedly gives the same value.
Returns:
String with the text of this body part

All Packages  Class Hierarchy  This Package  Previous  Next  Index