Package com.iplanet.am.util
Class QCharset
- java.lang.Object
-
- com.iplanet.am.util.QCharset
-
- All Implemented Interfaces:
Comparable
public class QCharset extends Object implements Comparable
This class represent charset to be used. The sorting of this object is based on the Q factor associated with it. The charaset object with more Q factor will be greater.This object allows to represent charaset values received from HTTP header. Example Accept-Charset: ISO-8859-1;Q=0.9 UTF-8 imples UTF-8 takes more precedence over ISO-8859-1. Possible Q values are any floating points between 0 and 1. if Q factor is missing it is assumed to be 1.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Object o1)Returns1ifo1's q value is higher.booleanequals(Object o1)StringgetName()floatgetQFactor()StringtoString()
-
-
-
Constructor Detail
-
QCharset
public QCharset(String name, float q)
Construct aQCharsetobject.- Parameters:
name- Name of the charset.q- Q factor to express preference. 0.0 < q < 1.0. Constructs newQCharsetset object with charset name and q value.
-
QCharset
public QCharset(String name)
- Parameters:
name- - Name of the charset Constructs new QCharset set object with charset name and q =1.0
-
-
Method Detail
-
getName
public String getName()
-
getQFactor
public float getQFactor()
-
compareTo
public int compareTo(Object o1)
Returns1ifo1's q value is higher. Returns-1ifo1's q value is lower. Returns0ifo1's q value is the same.- Specified by:
compareToin interfaceComparable- Parameters:
o1-QCharsettype object.- Returns:
-1,0,1based on q value.
-
-