- java.lang.Object
-
- jakarta.activation.DataSourceDataContentHandler
-
- All Implemented Interfaces:
DataContentHandler
class DataSourceDataContentHandler extends java.lang.Object implements DataContentHandler
-
-
Field Summary
Fields Modifier and Type Field Description private DataContentHandler
dch
private DataSource
ds
private ActivationDataFlavor[]
transferFlavors
-
Constructor Summary
Constructors Constructor Description DataSourceDataContentHandler(DataContentHandler dch, DataSource ds)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
getContent(DataSource ds)
Return an object representing the data in its most preferred form.java.lang.Object
getTransferData(ActivationDataFlavor df, DataSource ds)
Return the Transfer Data of type ActivationDataFlavor from InputStream.ActivationDataFlavor[]
getTransferDataFlavors()
Return the ActivationDataFlavors for thisDataContentHandler
.void
writeTo(java.lang.Object obj, java.lang.String mimeType, java.io.OutputStream os)
Write the object to the output stream.
-
-
-
Field Detail
-
ds
private DataSource ds
-
transferFlavors
private ActivationDataFlavor[] transferFlavors
-
dch
private DataContentHandler dch
-
-
Constructor Detail
-
DataSourceDataContentHandler
public DataSourceDataContentHandler(DataContentHandler dch, DataSource ds)
The constructor.
-
-
Method Detail
-
getTransferDataFlavors
public ActivationDataFlavor[] getTransferDataFlavors()
Return the ActivationDataFlavors for thisDataContentHandler
.- Specified by:
getTransferDataFlavors
in 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:
getTransferData
in 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) throws java.io.IOException
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 ActivationDataFlavor returned by thegetTransferDataFlavors
method.- Specified by:
getContent
in interfaceDataContentHandler
- Parameters:
ds
- The DataSource representing the data to be converted.- Returns:
- The constructed Object.
- Throws:
java.io.IOException
- if the data can't be accessed
-
writeTo
public void writeTo(java.lang.Object obj, java.lang.String mimeType, java.io.OutputStream os) throws java.io.IOException
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:
java.io.IOException
- errors writing to the stream
-
-