org.apache.axiom.attachments.impl
Class PartOnFile

java.lang.Object
  extended by org.apache.axiom.attachments.impl.AbstractPart
      extended by org.apache.axiom.attachments.impl.PartOnFile
All Implemented Interfaces:
Part

public class PartOnFile
extends AbstractPart

PartOnFile stores that attachment in a file. This implementation is used for very large attachments to reduce the in-memory footprint. The PartOnFile object is created by the PartFactory

See Also:
org.apache.axiom.attachments.impl.PartFactory.

Field Summary
(package private)  FileAccessor fileAccessor
           
(package private)  LifecycleManager manager
           
 
Constructor Summary
PartOnFile(LifecycleManager manager, java.util.Hashtable headers, java.io.InputStream is1, java.io.InputStream is2, java.lang.String attachmentDir)
          Create a PartOnFile from the specified InputStream
 
Method Summary
 javax.activation.DataHandler getDataHandler()
           
 java.lang.String getFileName()
          The part may be backed by a file.
 java.io.InputStream getInputStream()
           
 long getSize()
           
 
Methods inherited from class org.apache.axiom.attachments.impl.AbstractPart
addHeader, getAllHeaders, getContentID, getContentTransferEncoding, getContentType, getHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileAccessor

FileAccessor fileAccessor

manager

LifecycleManager manager
Constructor Detail

PartOnFile

PartOnFile(LifecycleManager manager,
           java.util.Hashtable headers,
           java.io.InputStream is1,
           java.io.InputStream is2,
           java.lang.String attachmentDir)
     throws java.io.IOException
Create a PartOnFile from the specified InputStream

Parameters:
headers - Hashtable of javax.mail.Headers
in1 - InputStream containing data
in2 - InputStream containing data
attachmentDir - String
Throws:
java.io.IOException
Method Detail

getDataHandler

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

getFileName

public 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
Specified by:
getFileName in class AbstractPart
Returns:
Throws:
javax.mail.MessagingException

getInputStream

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

getSize

public long getSize()
Specified by:
getSize in interface Part
Specified by:
getSize in class AbstractPart
Returns:
size