Package com.complexible.common.net

# Class MediaTypes

java.lang.Object
com.complexible.common.net.MediaTypes

public final class MediaTypes extends Object

Utility methods and constants for the Guava `MediaType` class

Since:
  2.0
Version:
  4.0.5
Author:
  Michael Grove

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final com.google.common.net.MediaType`
  `HTML`
  `static final com.google.common.net.MediaType`
  `JSON`
  `static final com.google.common.net.MediaType`
  `MULTIPART_FORM_DATA`
  `static final com.google.common.net.MediaType`
  `MULTIPART_MIXED`
  `static final com.google.common.net.MediaType`
  `TEXT`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `any(com.google.common.net.MediaType theType, com.google.common.net.MediaType theFirst, com.google.common.net.MediaType... theRest)`
  `static Predicate<com.google.common.net.MediaType>`
  `is(com.google.common.net.MediaType theType)`
  `static boolean`
  `isCompatibleWith(com.google.common.net.MediaType theType, com.google.common.net.MediaType theOtherType)`
  `static Predicate<com.google.common.net.MediaType>`
  `isCompatibleWith(String theType)`
  `static boolean`
  `isCompatibleWith(String theType, String theOtherType)`
  `static boolean`
  `isMultipart(com.google.common.net.MediaType theType)`
  `static com.google.common.net.MediaType`
  `parseMime(String theMime)`
  Parse the provide mime-type string into a `MediaType`.

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

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

- ## Field Details

  - ### MULTIPART_FORM_DATA

    public static final com.google.common.net.MediaType MULTIPART_FORM_DATA

  - ### MULTIPART_MIXED

    public static final com.google.common.net.MediaType MULTIPART_MIXED

  - ### JSON

    public static final com.google.common.net.MediaType JSON

  - ### TEXT

    public static final com.google.common.net.MediaType TEXT

  - ### HTML

    public static final com.google.common.net.MediaType HTML

- ## Method Details

  - ### is

    public static Predicate<com.google.common.net.MediaType> is(com.google.common.net.MediaType theType)

  - ### any

    public static boolean any(com.google.common.net.MediaType theType, com.google.common.net.MediaType theFirst, com.google.common.net.MediaType... theRest)

  - ### isCompatibleWith

    public static boolean isCompatibleWith(com.google.common.net.MediaType theType, com.google.common.net.MediaType theOtherType)

  - ### isCompatibleWith

    public static boolean isCompatibleWith(String theType, String theOtherType)

  - ### isCompatibleWith

    public static Predicate<com.google.common.net.MediaType> isCompatibleWith(String theType)

  - ### isMultipart

    public static boolean isMultipart(com.google.common.net.MediaType theType)

  - ### parseMime

    public static com.google.common.net.MediaType parseMime(String theMime)

    Parse the provide mime-type string into a `MediaType`. For the most part this is just a thin wrapper around `MediaType.parse(String)`, however, the `parse` method does not handle normalization of parameters, primarily, charset. However, `MediaType.withParameters(com.google.common.collect.Multimap)` does, so the result is passed through `withParameters` for normalization before returning the final result.

    `null` is interpreted to be `MediaType.ANY_TYPE`

    Parameters:
      `theMime` - the mime-type as a string
    Returns:
      the corresponding MediaType