uk.ac.starlink.auth

## Class ContentType

- java.lang.Object
- - uk.ac.starlink.auth.ContentType

-     public class ContentType
      extends java.lang.Object

  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
  See Also:
    RFC 2045

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContentType(java.lang.String type, java.lang.String subtype)` Constructs a ContentType from type and subtype strings.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    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()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ContentType

          public ContentType(java.lang.String type,
                             java.lang.String subtype)

      Constructs a ContentType from type and subtype strings. Case is normalised (to lower case).
      Parameters:
        `type` - type part
        `subtype` - subtype part

  - ### Method Detail

    - #### getType

          public java.lang.String getType()

      Returns the Type part of this content type.
      Returns:
        type

    - #### getSubtype

          public java.lang.String getSubtype()

      Returns the Subtype part of this content type.
      Returns:
        subtype

    - #### matches

          public boolean matches(java.lang.String type,
                                 java.lang.String subtype)

      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()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### parse

          public static ContentType parse(java.lang.String txt)

      Parses a Content-Type (MIME type) string.
      Parameters:
        `txt` - text representation of MIME type
      Returns:
        ContentType instance if syntax matches, else null