javax.activation
Class ObjectDataContentHandler

java.lang.Object
  |
  +--javax.activation.ObjectDataContentHandler
All Implemented Interfaces:
DataContentHandler

class ObjectDataContentHandler
extends Object
implements DataContentHandler


Constructor Summary
ObjectDataContentHandler(DataContentHandler dch, Object obj, String mimeType)
          The constructor.
 
Method Summary
 Object getContent(DataSource ds)
          Return an object representing the data in its most preferred form.
 DataContentHandler getDCH()
          Return the DataContentHandler for this object.
 Object getTransferData(DataFlavor df, DataSource ds)
          Return the Transfer Data of type DataFlavor from InputStream.
 DataFlavor[] getTransferDataFlavors()
          Return the DataFlavors for this DataContentHandler.
 void writeTo(Object obj, String mimeType, OutputStream os)
          Write the object to the output stream.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectDataContentHandler

public ObjectDataContentHandler(DataContentHandler dch,
                                Object obj,
                                String mimeType)
The constructor.
Method Detail

getDCH

public DataContentHandler getDCH()
Return the DataContentHandler for this object. Used only by the DataHandler class.

getTransferDataFlavors

public DataFlavor[] getTransferDataFlavors()
Return the DataFlavors for this DataContentHandler.
Specified by:
getTransferDataFlavors in interface DataContentHandler
Returns:
the DataFlavors

getTransferData

public Object getTransferData(DataFlavor df,
                              DataSource ds)
                       throws UnsupportedFlavorException,
                              IOException
Return the Transfer Data of type DataFlavor from InputStream.
Specified by:
getTransferData in interface DataContentHandler
Parameters:
df - the DataFlavor
ds - the DataSource
Returns:
the constructed Object

getContent

public Object getContent(DataSource ds)
Description copied from interface: DataContentHandler
Return an object representing the data in its most preferred form. Generally this will be the form described by the first DataFlavor returned by the getTransferDataFlavors method.
Specified by:
getContent in interface DataContentHandler
Following copied from interface: javax.activation.DataContentHandler
Parameters:
ds - The DataSource representing the data to be converted.
Returns:
The constructed Object.

writeTo

public void writeTo(Object obj,
                    String mimeType,
                    OutputStream os)
             throws IOException
Write the object to the output stream.
Specified by:
writeTo in interface DataContentHandler
Following copied from interface: javax.activation.DataContentHandler
Parameters:
obj - The object to be converted.
mimeType - The requested MIME type of the resulting byte stream.
os - The output stream into which to write the converted byte stream.