Package org.apache.cxf.attachment

## Class AttachmentUtil

- java.lang.Object
- - org.apache.cxf.attachment.AttachmentUtil

-     public final class AttachmentUtil
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `ATTACHMENT_CONTENT_TYPE` |
    `static String` | `ATTACHMENT_XOP_FOLLOW_URLS_PROPERTY` |
    `static String` | `BODY_ATTACHMENT_ID` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static String` | `cleanContentId​(String id)` |
    `static Attachment` | `createAttachment​(InputStream stream, Map<String,​List<String>> headers)` | Deprecated. use createAttachment(InputStream stream, Map> headers, Message message)
    `static Attachment` | `createAttachment​(InputStream stream, Map<String,​List<String>> headers, Message message)` |
    `static String` | `createContentID​(String ns)` |
    `static Attachment` | `createMtomAttachment​(boolean isXop, String mimeType, String elementNS, byte[] data, int offset, int length, int threshold)` |
    `static Attachment` | `createMtomAttachmentFromDH​(boolean isXop, javax.activation.DataHandler handler, String elementNS, int threshold)` |
    `static InputStream` | `decode​(InputStream in, String encoding)` |
    `static javax.activation.DataSource` | `getAttachmentDataSource​(String contentId, Collection<Attachment> atts)` |
    `static javax.activation.CommandMap` | `getCommandMap()` |
    `static Map<String,​javax.activation.DataHandler>` | `getDHMap​(Collection<Attachment> attachments)` |
    `static String` | `getUniqueBoundaryValue()` |
    `static boolean` | `isMtomEnabled​(Message message)` |
    `static boolean` | `isTypeSupported​(String contentType, List<String> types)` |
    `static void` | `setStreamedAttachmentProperties​(Message message, CachedOutputStream bos)` |

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

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

- - ### Field Detail

    - #### ATTACHMENT_CONTENT_TYPE

          public static final String ATTACHMENT_CONTENT_TYPE

      See Also:
        Constant Field Values

    - #### ATTACHMENT_XOP_FOLLOW_URLS_PROPERTY

          public static final String ATTACHMENT_XOP_FOLLOW_URLS_PROPERTY

      See Also:
        Constant Field Values

    - #### BODY_ATTACHMENT_ID

          public static final String BODY_ATTACHMENT_ID

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getCommandMap

          public static javax.activation.CommandMap getCommandMap()

    - #### isMtomEnabled

          public static boolean isMtomEnabled​(Message message)

    - #### setStreamedAttachmentProperties

          public static void setStreamedAttachmentProperties​(Message message,
                                                             CachedOutputStream bos)
                                                      throws IOException

      Throws:
        `IOException`

    - #### createContentID

          public static String createContentID​(String ns)
                                        throws UnsupportedEncodingException

      Throws:
        `UnsupportedEncodingException`

    - #### getUniqueBoundaryValue

          public static String getUniqueBoundaryValue()

    - #### getDHMap

          public static Map<String,​javax.activation.DataHandler> getDHMap​(Collection<Attachment> attachments)

    - #### cleanContentId

          public static String cleanContentId​(String id)

    - #### createAttachment

          public static Attachment createAttachment​(InputStream stream,
                                                    Map<String,​List<String>> headers)
                                             throws IOException

      Deprecated.
      use createAttachment(InputStream stream, Map> headers, Message message)
      Throws:
        `IOException`

    - #### createAttachment

          public static Attachment createAttachment​(InputStream stream,
                                                    Map<String,​List<String>> headers,
                                                    Message message)
                                             throws IOException

      Throws:
        `IOException`

    - #### decode

          public static InputStream decode​(InputStream in,
                                           String encoding)
                                    throws IOException

      Throws:
        `IOException`

    - #### isTypeSupported

          public static boolean isTypeSupported​(String contentType,
                                                List<String> types)

    - #### createMtomAttachment

          public static Attachment createMtomAttachment​(boolean isXop,
                                                        String mimeType,
                                                        String elementNS,
                                                        byte[] data,
                                                        int offset,
                                                        int length,
                                                        int threshold)

    - #### createMtomAttachmentFromDH

          public static Attachment createMtomAttachmentFromDH​(boolean isXop,
                                                              javax.activation.DataHandler handler,
                                                              String elementNS,
                                                              int threshold)

    - #### getAttachmentDataSource

          public static javax.activation.DataSource getAttachmentDataSource​(String contentId,
                                                                            Collection<Attachment> atts)