Package org.apache.axiom.mime

## Class PartDataHandler

- java.lang.Object
- - javax.activation.DataHandler
  - - org.apache.axiom.mime.PartDataHandler

- All Implemented Interfaces:
    `Transferable`

      public class PartDataHandler
      extends DataHandler

  `DataHandler` implementation for MIME parts read from a stream.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `PartDataHandler​(Part part)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected DataSource` | `createDataSource​(Part part, String contentType)` | Create the `DataSource` to be returned by `getDataSource()`.
    `DataSource` | `getDataSource()` |
    `Part` | `getPart()` | Get the MIME part linked to this data handler.
    `void` | `writeTo​(OutputStream os)` |

    - ### Methods inherited from class javax.activation.DataHandler

      `getAllCommands, getBean, getCommand, getContent, getContentType, getInputStream, getName, getOutputStream, getPreferredCommands, getTransferData, getTransferDataFlavors, isDataFlavorSupported, setCommandMap, setDataContentHandlerFactory`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PartDataHandler

          protected PartDataHandler​(Part part)

  - ### Method Detail

    - #### getPart

          public final Part getPart()

      Get the MIME part linked to this data handler.
      Returns:
        the MIME part

    - #### getDataSource

          public final DataSource getDataSource()

      Overrides:
        `getDataSource` in class `DataHandler`

    - #### createDataSource

          protected DataSource createDataSource​(Part part,
                                                String contentType)

      Create the `DataSource` to be returned by `getDataSource()`. This method may be overridden by subclasses to support custom `DataSource` implementations.
      Parameters:
        `part` - the `Part` backing this data handler
        `contentType` - the content type expected to be returned by `DataSource.getContentType()`; defaults to `application/octet-stream` if the part doesn't specify a content type
      Returns:
        the `DataSource` instance, or `null` to use the default implementation

    - #### writeTo

          public final void writeTo​(OutputStream os)
                             throws IOException

      Overrides:
        `writeTo` in class `DataHandler`
      Throws:
        `IOException`