Class MediaRange


  • public class MediaRange
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      MediaRange​(org.apache.tika.mime.MediaType type, double q)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double match​(org.apache.tika.mime.MediaType type, org.apache.tika.mime.MediaTypeRegistry registry)
      Matches the media range against the specified media type.
      static MediaRange parse​(java.lang.String range, org.apache.tika.mime.MediaTypeRegistry registry)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MediaRange

        public MediaRange​(org.apache.tika.mime.MediaType type,
                          double q)
    • Method Detail

      • parse

        public static MediaRange parse​(java.lang.String range,
                                       org.apache.tika.mime.MediaTypeRegistry registry)
      • match

        public double match​(org.apache.tika.mime.MediaType type,
                            org.apache.tika.mime.MediaTypeRegistry registry)
        Matches the media range against the specified media type.

        The "derived" quality value if computed from the specified q value (0 to 1) by subtracting 1/10000 in case the subtype in the range is "*", or 2/10000 if case both type and subtype are. This takes care of the precedence specified in RFC 7231, Section 5.3.2.

        Parameters:
        type - type to match
        registry - media type registry
        Returns:
        0.0 for "no match", the derived quality value if match
      • toString

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