Class handler_base

  • All Implemented Interfaces:
    javax.activation.DataContentHandler
    Direct Known Subclasses:
    image_gif, message_rfc822, multipart_mixed, text_plain

    public abstract class handler_base
    extends Object
    implements javax.activation.DataContentHandler
    Base class for other DataContentHandlers.
    • Constructor Detail

      • handler_base

        public handler_base()
    • Method Detail

      • getDataFlavors

        protected abstract javax.activation.ActivationDataFlavor[] getDataFlavors()
        Return an array of ActivationDataFlavors that we support. Usually there will be only one.
        Returns:
        array of ActivationDataFlavors that we support
      • getData

        protected Object getData​(javax.activation.ActivationDataFlavor aFlavor,
                                 javax.activation.DataSource ds)
                          throws IOException
        Given the flavor that matched, return the appropriate type of object. Usually there's only one flavor so just call getContent.
        Parameters:
        aFlavor - the ActivationDataFlavor
        ds - DataSource containing the data
        Returns:
        the object
        Throws:
        IOException - for errors reading the data
      • getTransferDataFlavors

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

        public Object getTransferData​(DataFlavor df,
                                      javax.activation.DataSource ds)
                               throws IOException
        Return the Transfer Data of type DataFlavor from InputStream.
        Specified by:
        getTransferData in interface javax.activation.DataContentHandler
        Parameters:
        df - The DataFlavor
        ds - The DataSource corresponding to the data
        Returns:
        the object
        Throws:
        IOException - for errors reading the data