Class DataSourceDataContentHandler

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object getContent​(DataSource ds)
      Return an object representing the data in its most preferred form.
      java.lang.Object getTransferData​(java.awt.datatransfer.DataFlavor df, DataSource ds)
      Return the Transfer Data of type DataFlavor from InputStream.
      java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
      Return the DataFlavors for this DataContentHandler.
      void writeTo​(java.lang.Object obj, java.lang.String mimeType, java.io.OutputStream os)
      Write the object to the output stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getTransferDataFlavors

        public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
        Return the DataFlavors for this DataContentHandler.
        Specified by:
        getTransferDataFlavors in interface DataContentHandler
        Returns:
        the DataFlavors
      • getTransferData

        public java.lang.Object getTransferData​(java.awt.datatransfer.DataFlavor df,
                                                DataSource ds)
                                         throws java.awt.datatransfer.UnsupportedFlavorException,
                                                java.io.IOException
        Return the Transfer Data of type DataFlavor from InputStream.
        Specified by:
        getTransferData in interface DataContentHandler
        Parameters:
        df - the DataFlavor
        ds - the DataSource
        Returns:
        the constructed Object
        Throws:
        java.awt.datatransfer.UnsupportedFlavorException - if the handler doesn't support the requested flavor
        java.io.IOException - if the data can't be accessed
      • getContent

        public java.lang.Object getContent​(DataSource ds)
                                    throws java.io.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 DataFlavor 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:
        java.io.IOException - if the data can't be accessed
      • writeTo

        public void writeTo​(java.lang.Object obj,
                            java.lang.String mimeType,
                            java.io.OutputStream os)
                     throws java.io.IOException
        Write the object 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:
        java.io.IOException - errors writing to the stream