Vordel SDK

com.vordel.mime
Class CompoundBody

java.lang.Object
  extended by com.vordel.mime.Body
      extended by com.vordel.mime.CompoundBody
All Implemented Interfaces:
com.vordel.system.Disposable
Direct Known Subclasses:
Multipart

public abstract class CompoundBody
extends Body

A compound body is an abstract class representing a Body type that is used to container other Bodys. MIME Multipart messages are CompoundBodys, as are Dime messages.

See Also:
Multipart

Field Summary
protected  java.lang.String rootPartId
           
 
Fields inherited from class com.vordel.mime.Body
CAN_INVALIDATE, contentType, CT_APP_OCTET_STREAM, CT_DEFAULT, CT_MULTIPART_RELATED, CT_TEXT_PLAIN, CT_TEXT_XML_UTF8, CT_XOP_APPLICATION_XML, headers, PUSH_WRITE, REMOVE_XFER_ENCODING_ON_WRITE, RETAIN_XFER_ENCODING_ON_READ
 
Constructor Summary
CompoundBody(HeaderSet headers, ContentType ct)
           
 
Method Summary
 void addPart(Body part)
           
 void addPart(java.lang.String id, Body part)
          Add a body part to this compound body, identified by "Id"
 void clear()
          Remove all parts of this compound body.
 Body getPart(java.lang.String id)
          Get a constituent body part by its ID
 java.lang.Iterable<Body> getParts()
          Get an iterator over all parts in this CompoundBody.
 java.util.Set<java.util.Map.Entry<java.lang.String,Body>> getPartsById()
          Return an Iterator over Set of Map.Entry objects, keyed by Content ID, with values of Body objects for each ID.
 java.util.Map<java.lang.String,Body> getPartsByIdMap()
          Return an Iterator over Set of Map.Entry objects, keyed by Content ID, with values of Body objects for each ID.
 int getPartsCount()
          Get the "start" For this message
 Body getStartPart()
          Get the "start" For this message
 void purgeContent()
          Purge a compound body.
 boolean removePart(Body body)
          Remove a body part
 boolean removePart(java.lang.String id)
          Remove a body part based on its Content-ID
 void replacePart(Body oldB, Body newB)
           
 void setStartPartID(java.lang.String startPartID)
          Set the ID of the part considered the "starting point"
 
Methods inherited from class com.vordel.mime.Body
bufferInput, contentAvailable, create, dispose, fini, getContentEncoding, getContentId, getContentLength, getContentType, getHeaders, getInputStream, getParent, getSource, initSource, parse, parse, registerFactory, setParent, write, writeContent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootPartId

protected java.lang.String rootPartId
Constructor Detail

CompoundBody

public CompoundBody(HeaderSet headers,
                    ContentType ct)
Method Detail

setStartPartID

public void setStartPartID(java.lang.String startPartID)
Set the ID of the part considered the "starting point"

Parameters:
startPartID - a string ID for the constituent bodypart.

getPart

public Body getPart(java.lang.String id)
             throws java.io.IOException
Get a constituent body part by its ID

Throws:
java.io.IOException

removePart

public boolean removePart(java.lang.String id)
                   throws java.io.IOException
Remove a body part based on its Content-ID

Parameters:
id - The content-id of the body part to remove.
Throws:
java.io.IOException

removePart

public boolean removePart(Body body)
                   throws java.io.IOException
Remove a body part

Parameters:
part - The body part to remove.
Throws:
java.io.IOException

getStartPart

public Body getStartPart()
                  throws java.io.IOException
Get the "start" For this message

Throws:
java.io.IOException

getPartsCount

public int getPartsCount()
                  throws java.io.IOException
Get the "start" For this message

Throws:
java.io.IOException

getParts

public java.lang.Iterable<Body> getParts()
                                  throws java.io.IOException
Get an iterator over all parts in this CompoundBody.

Throws:
java.io.IOException

getPartsById

public java.util.Set<java.util.Map.Entry<java.lang.String,Body>> getPartsById()
                                                                       throws java.io.IOException
Return an Iterator over Set of Map.Entry objects, keyed by Content ID, with values of Body objects for each ID.

Any parts that do not have a Content-Id will be assigned one

Returns:
above iterator.
Throws:
java.io.IOException

getPartsByIdMap

public java.util.Map<java.lang.String,Body> getPartsByIdMap()
                                                     throws java.io.IOException
Return an Iterator over Set of Map.Entry objects, keyed by Content ID, with values of Body objects for each ID.

Any parts that do not have a Content-Id will be assigned one

Returns:
above iterator.
Throws:
java.io.IOException

addPart

public void addPart(Body part)

addPart

public void addPart(java.lang.String id,
                    Body part)
             throws java.io.IOException
Add a body part to this compound body, identified by "Id"

Parameters:
id - the ID of the new bodypart
part - the new bodypart
Throws:
java.io.IOException

purgeContent

public void purgeContent()
Purge a compound body.

This method implements the interface from Body by iterating over all its constituent bodyparts, and purging those in turn.

Specified by:
purgeContent in class Body

clear

public void clear()
Remove all parts of this compound body.


replacePart

public void replacePart(Body oldB,
                        Body newB)
                 throws java.io.IOException
Throws:
java.io.IOException

Vordel SDK


This documentation and all its contents and graphics, copyright © 1999 - 2011 Vordel