public final class MediaTypes extends Object
Utility methods and constants for the Guava MediaType
class
Modifier and Type | Field and Description |
---|---|
static com.google.common.net.MediaType |
HTML |
static com.google.common.net.MediaType |
JSON |
static com.google.common.net.MediaType |
MULTIPART_FORM_DATA |
static com.google.common.net.MediaType |
MULTIPART_MIXED |
static com.google.common.net.MediaType |
TEXT |
Modifier and Type | Method and 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 . |
public static final com.google.common.net.MediaType MULTIPART_FORM_DATA
public static final com.google.common.net.MediaType MULTIPART_MIXED
public static final com.google.common.net.MediaType JSON
public static final com.google.common.net.MediaType TEXT
public static final com.google.common.net.MediaType HTML
public static Predicate<com.google.common.net.MediaType> is(com.google.common.net.MediaType theType)
public static boolean any(com.google.common.net.MediaType theType, com.google.common.net.MediaType theFirst, com.google.common.net.MediaType... theRest)
public static boolean isCompatibleWith(com.google.common.net.MediaType theType, com.google.common.net.MediaType theOtherType)
public static Predicate<com.google.common.net.MediaType> isCompatibleWith(String theType)
public static boolean isMultipart(com.google.common.net.MediaType theType)
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
theMime
- the mime-type as a stringCopyright © 2010-2016 Stardog Union. All Rights Reserved.