public class ContentType
extends java.lang.Object
This class is a stripped-down version of
uk.ac.starlink.util.ContentType
.
Constructor and Description |
---|
ContentType(java.lang.String type,
java.lang.String subtype)
Constructs a ContentType from type and subtype strings.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getSubtype()
Returns the Subtype part of this content type.
|
java.lang.String |
getType()
Returns the Type part of this content type.
|
int |
hashCode() |
boolean |
matches(java.lang.String type,
java.lang.String subtype)
Indicates whether the type and subtype match a given pair.
|
static ContentType |
parse(java.lang.String txt)
Parses a Content-Type (MIME type) string.
|
java.lang.String |
toString() |
public ContentType(java.lang.String type, java.lang.String subtype)
type
- type partsubtype
- subtype partpublic java.lang.String getType()
public java.lang.String getSubtype()
public boolean matches(java.lang.String type, java.lang.String subtype)
type
- required type part (case-insensitive)subtype
- required subtype part (case-insensitive)public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static ContentType parse(java.lang.String txt)
txt
- text representation of MIME type