Package com.helger.http.header.specific
Class AcceptCharsetList
Represents a list of Accept-Charset values as specified in the HTTP header
- Author:
- Philip Helger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NonNull AcceptCharsetListaddCharset(@NonNull @Nonempty String sCharset, double dQuality) Add a charset by name with the given quality.@NonNull AcceptCharsetListaddCharset(@NonNull Charset aCharset, double dQuality) Add a charset with the given quality.booleanexplicitlySupportsCharset(@NonNull String sCharset) Check if the passed charset is explicitly supported (without wildcard fallback).@NonNull StringdoublegetQualityOfCharset(@NonNull String sCharset) Return the associated quality of the given charset.@NonNull QValuegetQValueOfCharset(@NonNull String sCharset) Return the associated quality of the given charset.booleansupportsCharset(@NonNull String sCharset) Check if the passed charset is supported.Methods inherited from class com.helger.http.header.AbstractQValueList
equals, getAllQValues, getAllQValuesGreaterOrEqual, getAllQValuesGreaterThan, getAllQValuesLowerOrEqual, getAllQValuesLowerThan, getAsHttpHeaderValue, getAsHttpHeaderValue, hashCode, qvalueMap, toString
-
Constructor Details
-
AcceptCharsetList
public AcceptCharsetList()Constructor creating an empty accept charset list.
-
-
Method Details
-
addCharset
public @NonNull AcceptCharsetList addCharset(@NonNull Charset aCharset, @Nonnegative double dQuality) Add a charset with the given quality.- Parameters:
aCharset- The charset to add. May not benull.dQuality- The quality value between 0 and 1.- Returns:
- this for chaining
-
addCharset
public @NonNull AcceptCharsetList addCharset(@Nonempty @NonNull @Nonempty String sCharset, @Nonnegative double dQuality) Add a charset by name with the given quality.- Parameters:
sCharset- The charset name to add. May neither benullnor empty.dQuality- The quality value between 0 and 1.- Returns:
- this for chaining
-
getQValueOfCharset
Return the associated quality of the given charset.- Parameters:
sCharset- The charset name to query. May not benull.- Returns:
- The associated
QValue.
-
getQualityOfCharset
Return the associated quality of the given charset.- Parameters:
sCharset- The charset name to query. May not benull.- Returns:
- 0 means not accepted, 1 means fully accepted.
-
supportsCharset
Check if the passed charset is supported. Supported means the quality is > 0.- Parameters:
sCharset- The charset name to be checked. May not benull.- Returns:
trueif the charset is supported,falseif not.
-
explicitlySupportsCharset
Check if the passed charset is explicitly supported (without wildcard fallback). Supported means the quality is > 0.- Parameters:
sCharset- The charset name to be checked. May not benull.- Returns:
trueif the charset is explicitly supported,falseif not.
-
getAsHttpHeaderValue
- Specified by:
getAsHttpHeaderValuein classAbstractQValueList<String>- Returns:
- The string representation of this list e.g. for usage in HTTP headers.
-