Class ImageDataContentHandler

java.lang.Object
org.apache.cxf.attachment.ImageDataContentHandler
All Implemented Interfaces:
DataContentHandler

public class ImageDataContentHandler extends Object implements DataContentHandler
  • Constructor Details

    • ImageDataContentHandler

      public ImageDataContentHandler()
  • Method Details

    • getContent

      public Object getContent(DataSource ds) throws 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 the getTransferDataFlavors method.
      Specified by:
      getContent in interface DataContentHandler
      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: DataContentHandler
      Returns 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:
      getTransferData in interface DataContentHandler
      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: DataContentHandler
      Returns 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:
      getTransferDataFlavors in interface DataContentHandler
      Returns:
      The ActivationDataFlavors.
    • writeTo

      public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException
      Description copied from interface: DataContentHandler
      Convert the object to a byte stream of the specified MIME type and write it to the output stream.
      Specified by:
      writeTo in interface DataContentHandler
      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