- java.lang.Object
-
- jakarta.activation.ObjectDataContentHandler
-
- All Implemented Interfaces:
DataContentHandler
class ObjectDataContentHandler extends java.lang.Object implements DataContentHandler
-
-
Field Summary
Fields Modifier and Type Field Description private DataContentHandlerdchprivate java.lang.StringmimeTypeprivate java.lang.Objectobjprivate ActivationDataFlavor[]transferFlavors
-
Constructor Summary
Constructors Constructor Description ObjectDataContentHandler(DataContentHandler dch, java.lang.Object obj, java.lang.String mimeType)The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectgetContent(DataSource ds)Return an object representing the data in its most preferred form.DataContentHandlergetDCH()Return the DataContentHandler for this object.java.lang.ObjectgetTransferData(ActivationDataFlavor df, DataSource ds)Return the Transfer Data of type ActivationDataFlavor from InputStream.ActivationDataFlavor[]getTransferDataFlavors()Return the ActivationDataFlavors for thisDataContentHandler.voidwriteTo(java.lang.Object obj, java.lang.String mimeType, java.io.OutputStream os)Write the object to the output stream.
-
-
-
Field Detail
-
transferFlavors
private ActivationDataFlavor[] transferFlavors
-
obj
private java.lang.Object obj
-
mimeType
private java.lang.String mimeType
-
dch
private DataContentHandler dch
-
-
Constructor Detail
-
ObjectDataContentHandler
public ObjectDataContentHandler(DataContentHandler dch, java.lang.Object obj, java.lang.String mimeType)
The constructor.
-
-
Method Detail
-
getDCH
public DataContentHandler getDCH()
Return the DataContentHandler for this object. Used only by the DataHandler class.
-
getTransferDataFlavors
public ActivationDataFlavor[] getTransferDataFlavors()
Return the ActivationDataFlavors for thisDataContentHandler.- Specified by:
getTransferDataFlavorsin interfaceDataContentHandler- Returns:
- the ActivationDataFlavors
-
getTransferData
public java.lang.Object getTransferData(ActivationDataFlavor df, DataSource ds) throws java.io.IOException
Return the Transfer Data of type ActivationDataFlavor from InputStream.- Specified by:
getTransferDatain interfaceDataContentHandler- Parameters:
df- the ActivationDataFlavords- the DataSource- Returns:
- the constructed Object
- Throws:
java.io.IOException- if the handler doesn't support the requested flavor
-
getContent
public java.lang.Object getContent(DataSource ds)
Description copied from interface:DataContentHandlerReturn an object representing the data in its most preferred form. Generally this will be the form described by the first ActivationDataFlavor returned by thegetTransferDataFlavorsmethod.- Specified by:
getContentin interfaceDataContentHandler- Parameters:
ds- The DataSource representing the data to be converted.- Returns:
- The constructed Object.
-
writeTo
public void writeTo(java.lang.Object obj, java.lang.String mimeType, java.io.OutputStream os) throws java.io.IOExceptionWrite the object to the output stream.- Specified by:
writeToin interfaceDataContentHandler- 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.- Throws:
java.io.IOException- errors writing to the stream
-
-