public class MediaRangeList.MediaRange extends java.lang.Object implements java.lang.Comparable<MediaRangeList.MediaRange>
MediaRange represents an entry in a MediaRangeList.
The MediaRange consists of a supertype and a subtype,
optionally a quality factor parameter q and other arbitrary parameters.| Constructor and Description |
|---|
MediaRange(java.lang.String exp)
Constructs a
MediaRange from a String expression. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(MediaRangeList.MediaRange o) |
boolean |
equals(java.lang.Object obj) |
boolean |
equals(java.lang.String s) |
java.lang.String |
getParameter(java.lang.String key) |
java.util.Map<java.lang.String,java.lang.String> |
getParameters() |
double |
getQ()
Get the value of the quality factor parameter (
q). |
java.lang.String |
getSubtype() |
java.lang.String |
getSupertype() |
boolean |
matchesAll()
Returns
true if this is a catch-all media range (*/*). |
java.lang.String |
toString() |
public MediaRange(java.lang.String exp)
MediaRange from a String expression.exp - The String to construct the MediaRange from. The string is
expected to be on the form ( "*/*"
| ( type "/" "*" )
| ( type "/" subtype )
) *( ";" parameter )Examples:
text/html;q=0.8text/htmltext/html;level=3text/html;level=3;q=0.7text/**/**), then the subtype component
must also be wildcard.
The quality factor parameter must be between 0 and 1, inclusive
(see RFC 2616 section 3.9).
If the expression does not contain a q parameter, the MediaRange is given
a default quality factor of 1.
java.lang.IllegalArgumentException - if exp can not be parsed to a valid media rangejava.lang.NullPointerException - if exp is nullpublic boolean matchesAll()
true if this is a catch-all media range (*/*).true if this range is a catch-all media range, false otherwisepublic java.lang.String getParameter(java.lang.String key)
public java.lang.String getSupertype()
public java.lang.String getSubtype()
public double getQ()
q).public java.util.Map<java.lang.String,java.lang.String> getParameters()
public int compareTo(MediaRangeList.MediaRange o)
compareTo in interface java.lang.Comparable<MediaRangeList.MediaRange>public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic boolean equals(java.lang.String s)
public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2022 The Apache Software Foundation. All rights reserved.