javax.activation

Interface DataContentHandler

public interface DataContentHandler

Provider that can convert streams to objects and vice versa.

Method Summary

Object
getContent(DataSource ds)
Returns an object representing the data in its most preferred form.
Object
getTransferData(DataFlavor df, DataSource ds)
Returns an object representing the data to be transferred.
DataFlavor[]
getTransferDataFlavors()
Returns a list of the flavors that data can be provided in, ordered by preference.
void
writeTo(Object obj, String mimeType, OutputStream os)
Writes the object as a stream of bytes.

Method Details

getContent

public Object getContent(DataSource ds)
            throws IOException
Returns an object representing the data in its most preferred form.

Parameters:
ds - the data source of the data to be converted


getTransferData

public Object getTransferData(DataFlavor df,
                              DataSource ds)
            throws UnsupportedFlavorException,
                   IOException
Returns an object representing the data to be transferred.

Parameters:
df - the flavor representing the requested type
ds - the data source of the data to be converted


getTransferDataFlavors

public DataFlavor[] getTransferDataFlavors()
Returns a list of the flavors that data can be provided in, ordered by preference.


writeTo

public void writeTo(Object obj,
                    String mimeType,
                    OutputStream os)
            throws IOException
Writes the object as a stream of bytes.

Parameters:
obj - the object to convert
mimeType - the MIME type of the stream
os - the byte stream