Package uk.ac.starlink.auth
Class ContentType
java.lang.Object
uk.ac.starlink.auth.ContentType
Simple abstraction of MIME type.
This class represents the basic MIME type/subtype,
but does not attempt to represent content-type parameters.
This class is a stripped-down version of
uk.ac.starlink.util.ContentType
.
- Since:
- 20 May 2021
- Author:
- Mark Taylor
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionContentType
(String type, String subtype) Constructs a ContentType from type and subtype strings. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the Subtype part of this content type.getType()
Returns the Type part of this content type.int
hashCode()
boolean
Indicates whether the type and subtype match a given pair.static ContentType
Parses a Content-Type (MIME type) string.toString()
-
Constructor Details
-
ContentType
Constructs a ContentType from type and subtype strings. Case is normalised (to lower case).- Parameters:
type
- type partsubtype
- subtype part
-
-
Method Details
-
getType
Returns the Type part of this content type.- Returns:
- type
-
getSubtype
Returns the Subtype part of this content type.- Returns:
- subtype
-
matches
Indicates whether the type and subtype match a given pair.- Parameters:
type
- required type part (case-insensitive)subtype
- required subtype part (case-insensitive)- Returns:
- true iff type and subtype match those of this content-type
-
hashCode
public int hashCode() -
equals
-
toString
-
parse
Parses a Content-Type (MIME type) string.- Parameters:
txt
- text representation of MIME type- Returns:
- ContentType instance if syntax matches, else null
-