Package javax.activation
Class ObjectDataContentHandler
java.lang.Object
javax.activation.ObjectDataContentHandler
- All Implemented Interfaces:
DataContentHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DataContentHandler
private String
private Object
private DataFlavor[]
-
Constructor Summary
ConstructorsConstructorDescriptionObjectDataContentHandler
(DataContentHandler dch, Object obj, String mimeType) The constructor. -
Method Summary
Modifier and TypeMethodDescriptiongetContent
(DataSource ds) Return an object representing the data in its most preferred form.getDCH()
Return the DataContentHandler for this object.getTransferData
(DataFlavor df, DataSource ds) Return the Transfer Data of type DataFlavor from InputStream.Return the DataFlavors for thisDataContentHandler
.void
writeTo
(Object obj, String mimeType, OutputStream os) Write the object to the output stream.
-
Field Details
-
transferFlavors
-
obj
-
mimeType
-
dch
-
-
Constructor Details
-
ObjectDataContentHandler
The constructor.
-
-
Method Details
-
getDCH
Return the DataContentHandler for this object. Used only by the DataHandler class. -
getTransferDataFlavors
Return the DataFlavors for thisDataContentHandler
.- Specified by:
getTransferDataFlavors
in interfaceDataContentHandler
- 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 interfaceDataContentHandler
- Parameters:
df
- the DataFlavords
- the DataSource- Returns:
- the constructed Object
- Throws:
UnsupportedFlavorException
- if the handler doesn't support the requested flavorIOException
- if the data can't be accessed
-
getContent
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 thegetTransferDataFlavors
method.- Specified by:
getContent
in interfaceDataContentHandler
- Parameters:
ds
- The DataSource representing the data to be converted.- Returns:
- The constructed Object.
-
writeTo
Write the object to the output stream.- Specified by:
writeTo
in 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:
IOException
- errors writing to the stream
-