Package org.apache.cxf.attachment
Class ImageDataContentHandler
- java.lang.Object
-
- org.apache.cxf.attachment.ImageDataContentHandler
-
- All Implemented Interfaces:
DataContentHandler
public class ImageDataContentHandler extends Object implements DataContentHandler
-
-
Constructor Summary
Constructors Constructor Description ImageDataContentHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetContent(DataSource ds)Return an object representing the data in its most preferred form.ObjectgetTransferData(ActivationDataFlavor df, DataSource ds)Returns an object which represents the data to be transferred.ActivationDataFlavor[]getTransferDataFlavors()Returns an array of ActivationDataFlavor objects indicating the flavors the data can be provided in.voidwriteTo(Object obj, String mimeType, OutputStream os)Convert the object to a byte stream of the specified MIME type and write it to the output stream.
-
-
-
Method Detail
-
getContent
public Object getContent(DataSource ds) throws IOException
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.
- Throws:
IOException- if the data can't be accessed
-
getTransferData
public Object getTransferData(ActivationDataFlavor df, DataSource ds) throws IOException
Description copied from interface:DataContentHandlerReturns an object which represents the data to be transferred. The class of the object returned is defined by the representation class of the flavor.- Specified by:
getTransferDatain interfaceDataContentHandler- Parameters:
df- The ActivationDataFlavor representing the requested type.ds- The DataSource representing the data to be converted.- Returns:
- The constructed Object.
- Throws:
IOException- if the handler doesn't support the requested flavor
-
getTransferDataFlavors
public ActivationDataFlavor[] getTransferDataFlavors()
Description copied from interface:DataContentHandlerReturns an array of ActivationDataFlavor objects indicating the flavors the data can be provided in. The array should be ordered according to preference for providing the data (from most richly descriptive to least descriptive).- Specified by:
getTransferDataFlavorsin interfaceDataContentHandler- Returns:
- The ActivationDataFlavors.
-
writeTo
public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException
Description copied from interface:DataContentHandlerConvert the object to a byte stream of the specified MIME type and write it 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:
IOException- errors writing to the stream
-
-