Package com.complexible.common.net
Class MediaTypes
- java.lang.Object
-
- com.complexible.common.net.MediaTypes
-
public final class MediaTypes extends java.lang.ObjectUtility methods and constants for the Guava
MediaTypeclass- Since:
- 2.0
- Version:
- 4.0.5
- Author:
- Michael Grove
-
-
Field Summary
Fields Modifier and Type Field Description static com.google.common.net.MediaTypeHTMLstatic com.google.common.net.MediaTypeJSONstatic com.google.common.net.MediaTypeMULTIPART_FORM_DATAstatic com.google.common.net.MediaTypeMULTIPART_MIXEDstatic com.google.common.net.MediaTypeTEXT
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanany(com.google.common.net.MediaType theType, com.google.common.net.MediaType theFirst, com.google.common.net.MediaType... theRest)static java.util.function.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 java.util.function.Predicate<com.google.common.net.MediaType>isCompatibleWith(java.lang.String theType)static booleanisCompatibleWith(java.lang.String theType, java.lang.String theOtherType)static booleanisMultipart(com.google.common.net.MediaType theType)static com.google.common.net.MediaTypeparseMime(java.lang.String theMime)Parse the provide mime-type string into aMediaType.
-
-
-
Field Detail
-
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 Detail
-
is
public static java.util.function.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(java.lang.String theType, java.lang.String theOtherType)
-
isCompatibleWith
public static java.util.function.Predicate<com.google.common.net.MediaType> isCompatibleWith(java.lang.String theType)
-
isMultipart
public static boolean isMultipart(com.google.common.net.MediaType theType)
-
parseMime
public static com.google.common.net.MediaType parseMime(java.lang.String theMime)
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
-
-