Package org.n52.janmayen.http
Class MediaType
java.lang.Object
org.n52.janmayen.http.MediaType
- All Implemented Interfaces:
Comparable<MediaType>,Similar<MediaType>
TODO JavaDoc
- Since:
- 1.0.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a*/*media type.Constructs atype/*media type.Constructs atype/subtypemedia type.Constructs atype/subtype;parameter="name"media type.Constructs a media type using the supplied parameters. -
Method Summary
Modifier and TypeMethodDescriptionstatic MediaTypeany()static MediaTypestatic MediaTypeanyAudio()static MediaTypeanyImage()static MediaTypestatic MediaTypeanyModel()static MediaTypestatic MediaTypeanyText()static MediaTypeanyVideo()static MediaTypeapplication(String subtype) static MediaTypeapplication(String subtype, String parameterName, String parameterValue) static MediaTypeintbooleangetParameter(String parameter) floatintgetSimilarity(MediaType other) x = 0 ⇔ equal x < 0 ⇔ not similar x > 0 ⇔ similar y > 0 & x > y ⇔ x more similar than ygetType()inthashCode()booleanhasParameter(String parameter) booleanstatic MediaTypebooleanisCompatible(MediaType other) booleanbooleanbooleanstatic MediaTypestatic MediaTypestatic MediaTypestatic StringnormalizeString(String string) Normalize mime type string by processing it through the MediaType parser.static MediaTypestatic MediaTypetoString()static MediaTypewithoutParameter(String parameter) withParameter(String parameter, String value) withParameters(Map<String, ? extends Collection<String>> parameters) withSubType(String subtype)
-
Field Details
-
IMAGE_TYPE
- See Also:
-
AUDIO_TYPE
- See Also:
-
VIDEO_TYPE
- See Also:
-
MESSAGE_TYPE
- See Also:
-
MODEL_TYPE
- See Also:
-
MULTIPART_TYPE
- See Also:
-
APPLICATION_TYPE
- See Also:
-
TEXT_TYPE
- See Also:
-
WILDCARD_TYPE
- See Also:
-
-
Constructor Details
-
MediaType
public MediaType()Constructs a*/*media type. -
MediaType
Constructs atype/*media type.- Parameters:
type- the type (may benullfor a wild card)
-
MediaType
Constructs atype/subtypemedia type.- Parameters:
type- the type (may benullfor a wild card)subtype- the subtype (may benullfor a wild card)
-
MediaType
Constructs atype/subtype;parameter="name"media type.- Parameters:
type- the type (may benullfor a wild card)subtype- the subtype (may benullfor a wild card)parameter- the parameterparameterValue- the parameter value
-
MediaType
Constructs a media type using the supplied parameters.- Parameters:
type- the type (may benullfor a wild card)subtype- the subtype (may benullfor a wild card)parameters- the parameter map
-
-
Method Details
-
getType
-
getSubtype
-
getParameters
-
isWildcard
public boolean isWildcard() -
isWildcardType
public boolean isWildcardType() -
isWildcardSubtype
public boolean isWildcardSubtype() -
isCompatible
-
getParameter
-
hasParameter
-
getQuality
public float getQuality() -
withType
-
withSubType
-
hasParameters
public boolean hasParameters() -
withParameter
-
withParameters
-
withoutParameter
-
withoutQuality
-
withoutParameters
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<MediaType>
-
toString
-
getSimilarity
Description copied from interface:Similarx = 0 ⇔ equal x < 0 ⇔ not similar x > 0 ⇔ similar y > 0 & x > y ⇔ x more similar than y
- Specified by:
getSimilarityin interfaceSimilar<MediaType>- Parameters:
other- the other object- Returns:
- the similarity value
-
parse
-
normalizeString
Normalize mime type string by processing it through the MediaType parser. Handles differing spaces between type and subtype, etc.- Parameters:
string- Mime type string to normalize- Returns:
- Normalized mime type string
-
application
-
application
-
text
-
image
-
audio
-
video
-
message
-
model
-
multipart
-
any
-
anyApplication
-
anyText
-
anyImage
-
anyAudio
-
anyVideo
-
anyMessage
-
anyModel
-
anyMultipart
-