org.apache.axiom.attachments.impl
Class AbstractPart

java.lang.Object
  extended by org.apache.axiom.attachments.impl.AbstractPart
All Implemented Interfaces:
Part
Direct Known Subclasses:
PartOnFile, PartOnMemory, PartOnMemoryEnhanced

abstract class AbstractPart
extends java.lang.Object
implements Part

AbstractPart is a base class for the actual Part implementations. The primary purpose of AbstractPart is to define some of the common methods to promote code reuse.


Field Summary
private  java.util.Hashtable headers
           
private static org.apache.commons.logging.Log log
           
 
Constructor Summary
AbstractPart(java.util.Hashtable in)
          The actual parts are constructed with the PartFactory.
 
Method Summary
 void addHeader(java.lang.String name, java.lang.String value)
          Add a Header (name, value) to the part
 java.util.Enumeration getAllHeaders()
           
 java.lang.String getContentID()
           
 java.lang.String getContentTransferEncoding()
           
 java.lang.String getContentType()
           
abstract  javax.activation.DataHandler getDataHandler()
           
abstract  java.lang.String getFileName()
          The part may be backed by a file.
 java.lang.String getHeader(java.lang.String name)
          Get the value of a specific header
abstract  java.io.InputStream getInputStream()
           
abstract  long getSize()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log

headers

private java.util.Hashtable headers
Constructor Detail

AbstractPart

AbstractPart(java.util.Hashtable in)
The actual parts are constructed with the PartFactory.

Parameters:
headers -
See Also:
PartFactory
Method Detail

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String value)
Description copied from interface: Part
Add a Header (name, value) to the part

Specified by:
addHeader in interface Part

getAllHeaders

public java.util.Enumeration getAllHeaders()
                                    throws javax.mail.MessagingException
Specified by:
getAllHeaders in interface Part
Returns:
Enumeration of javax.mail.Header
Throws:
javax.mail.MessagingException

getHeader

public java.lang.String getHeader(java.lang.String name)
Description copied from interface: Part
Get the value of a specific header

Specified by:
getHeader in interface Part
Returns:
value or null

getContentID

public java.lang.String getContentID()
                              throws javax.mail.MessagingException
Specified by:
getContentID in interface Part
Returns:
content id of the part
Throws:
javax.mail.MessagingException

getContentType

public java.lang.String getContentType()
                                throws javax.mail.MessagingException
Specified by:
getContentType in interface Part
Returns:
content type of the part
Throws:
javax.mail.MessagingException

getContentTransferEncoding

public java.lang.String getContentTransferEncoding()
                                            throws javax.mail.MessagingException
Returns:
contentTransferEncoding
Throws:
javax.mail.MessagingException

getDataHandler

public abstract javax.activation.DataHandler getDataHandler()
                                                     throws javax.mail.MessagingException
Specified by:
getDataHandler in interface Part
Returns:
DataHandler representing this part
Throws:
javax.mail.MessagingException

getFileName

public abstract java.lang.String getFileName()
                                      throws javax.mail.MessagingException
Description copied from interface: Part
The part may be backed by a file. If that is the case, this method returns the file name.

Specified by:
getFileName in interface Part
Returns:
Throws:
javax.mail.MessagingException

getInputStream

public abstract java.io.InputStream getInputStream()
                                            throws java.io.IOException,
                                                   javax.mail.MessagingException
Specified by:
getInputStream in interface Part
Returns:
Get the part data as an input stream
Throws:
java.io.IOException
javax.mail.MessagingException

getSize

public abstract long getSize()
                      throws javax.mail.MessagingException
Specified by:
getSize in interface Part
Returns:
size
Throws:
javax.mail.MessagingException