Class MediaType


  • public class MediaType
    extends java.lang.Object
    Represents a MediaType as described at http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
    • Constructor Summary

      Constructors 
      Constructor Description
      MediaType​(java.lang.String mediatype)
      Construct
    • Constructor Detail

      • MediaType

        public MediaType​(java.lang.String mediatype)
        Construct
        Parameters:
        mediatype - string representation of mediatype e.g. text/html;level=1;q=0.8
    • Method Detail

      • getType

        public java.lang.String getType()
        Returns:
        type
      • getSubtype

        public java.lang.String getSubtype()
        Returns:
        subtype
      • getParams

        public java.lang.String getParams()
        Returns:
        params
      • getQuality

        public float getQuality()
        Returns:
        quality factory
      • compare

        public float compare​(MediaType to)
        Compare to another media type
        Parameters:
        to - media type to compare to
        Returns:
        score representing how close a match the compared media types are
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • main

        public static void main​(java.lang.String[] args)
        Simple exampe usage
        Parameters:
        args - String[]