Package com.complexible.common.net
Class MediaTypes
java.lang.Object
com.complexible.common.net.MediaTypes
Utility methods and constants for the Guava MediaType class
- Since:
- 2.0
- Version:
- 4.0.5
- Author:
- Michael Grove
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.google.common.net.MediaTypestatic final com.google.common.net.MediaTypestatic final com.google.common.net.MediaTypestatic final com.google.common.net.MediaTypestatic final com.google.common.net.MediaType -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanany(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 booleanisCompatibleWith(com.google.common.net.MediaType theType, com.google.common.net.MediaType theOtherType) static Predicate<com.google.common.net.MediaType> isCompatibleWith(String theType) static booleanisCompatibleWith(String theType, String theOtherType) static booleanisMultipart(com.google.common.net.MediaType theType) static com.google.common.net.MediaTypeParse the provide mime-type string into aMediaType.
-
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
-
isCompatibleWith
-
isMultipart
public static boolean isMultipart(com.google.common.net.MediaType theType) -
parseMime
Parse the provide mime-type string into a
MediaType. For the most part this is just a thin wrapper aroundMediaType.parse(String), however, theparsemethod does not handle normalization of parameters, primarily, charset. However,MediaType.withParameters(com.google.common.collect.Multimap)does, so the result is passed throughwithParametersfor normalization before returning the final result.nullis interpreted to beMediaType.ANY_TYPE- Parameters:
theMime- the mime-type as a string- Returns:
- the corresponding MediaType
-