Package org.zkoss.util.media

## Class ContentTypes

- java.lang.Object
- - org.zkoss.util.media.ContentTypes

-     public class ContentTypes
      extends java.lang.Object

  Utilities relevant to content types.
  Author:
    tomyeh

- - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `ContentTypes()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static java.lang.String` | `getContentType​(java.lang.String format)` | Returns the content type of the specified format, such as "html" and "pdf", or null if not found (or format is null).
    `static java.lang.String` | `getFormat​(java.lang.String ctype)` | Returns the format of the specified content type, or null if not found.
    `static boolean` | `isBinary​(java.lang.String ctype)` | Returns whether the content type is binary.
    `static void` | `put​(java.lang.String format, java.lang.String ctype)` | Adds additional binding of the format and content type.

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

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

- - ### Constructor Detail

    - #### ContentTypes

          protected ContentTypes()

  - ### Method Detail

    - #### isBinary

          public static final boolean isBinary​(java.lang.String ctype)

      Returns whether the content type is binary.
      Parameters:
        `ctype` - the content type, e.g., text/plain If ctype is null or empty, false is returned.
      Since:
        3.0.6

    - #### getContentType

          public static final java.lang.String getContentType​(java.lang.String format)

      Returns the content type of the specified format, such as "html" and "pdf", or null if not found (or format is null).

    - #### getFormat

          public static final java.lang.String getFormat​(java.lang.String ctype)

      Returns the format of the specified content type, or null if not found.
      Throws:
        `IllealArgumentException` - if ctype is null

    - #### put

          public static final void put​(java.lang.String format,
                                       java.lang.String ctype)

      Adds additional binding of the format and content type.

      You rarely need to invoke this method, unless your format is not by the default mapping.