Package javax.activation
Class DataSourceDataContentHandler
java.lang.Object
javax.activation.DataSourceDataContentHandler
- All Implemented Interfaces:
DataContentHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DataContentHandler
private DataSource
private DataFlavor[]
-
Constructor Summary
ConstructorsConstructorDescriptionThe constructor. -
Method Summary
Modifier and TypeMethodDescriptiongetContent
(DataSource ds) Return an object representing the data in its most preferred form.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
-
ds
-
transferFlavors
-
dch
-
-
Constructor Details
-
DataSourceDataContentHandler
The constructor.
-
-
Method Details
-
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.
- Throws:
IOException
- if the data can't be accessed
-
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
-