Class StringDataContentHandler

java.lang.Object
com.sun.xml.messaging.saaj.soap.StringDataContentHandler
All Implemented Interfaces:
DataContentHandler

public class StringDataContentHandler extends Object implements DataContentHandler
JAF data content handler for text/plain --> String
  • Constructor Details

    • StringDataContentHandler

      public StringDataContentHandler()
  • Method Details

    • getDF

      protected ActivationDataFlavor getDF()
    • getTransferDataFlavors

      public ActivationDataFlavor[] getTransferDataFlavors()
      Return the DataFlavors for this DataContentHandler.
      Specified by:
      getTransferDataFlavors in interface DataContentHandler
      Returns:
      The DataFlavors
    • getTransferData

      public Object getTransferData(ActivationDataFlavor df, DataSource ds) throws IOException
      Return the Transfer Data of type DataFlavor from InputStream.
      Specified by:
      getTransferData in interface DataContentHandler
      Parameters:
      df - The DataFlavor
      ds - The DataSource corresponding to the data
      Returns:
      String object
      Throws:
      IOException - if the handler doesn't support the requested flavor
    • 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
    • writeTo

      public void writeTo(Object obj, String type, OutputStream os) throws IOException
      Write the object to the output stream, using the specified MIME type.
      Specified by:
      writeTo in interface DataContentHandler
      Parameters:
      obj - The object to be converted.
      type - 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