| java.lang.Object com.noelios.restlet.util.PreferenceUtils
PreferenceUtils | public class PreferenceUtils (Code) | | Preference manipulation utilities.
author: Jerome Louvel (contact@noelios.com) |
Method Summary | |
public static String | format(List<? extends Preference<?>> prefs) Formats a list of preferences with a comma separator.
Parameters: prefs - The list of preferences. | public static void | format(Preference pref, Appendable destination) Formats a preference. | public static void | formatQuality(float quality, Appendable destination) Formats a quality value. If the quality is invalid, an
IllegalArgumentException is thrown. | public static boolean | isQuality(float quality) Indicates if the quality value is valid.
Parameters: quality - The quality value. | public static void | parseCharacterSets(String acceptCharsetHeader, ClientInfo client) Parses character set preferences from a header. | public static void | parseEncodings(String acceptEncodingHeader, ClientInfo preference) Parses encoding preferences from a header. | public static void | parseLanguages(String acceptLanguageHeader, ClientInfo preference) Parses language preferences from a header. | public static void | parseMediaTypes(String acceptMediaTypeHeader, ClientInfo preference) Parses media type preferences from a header. | public static float | parseQuality(String quality) Parses a quality value. If the quality is invalid, an
IllegalArgumentException is thrown.
Parameters: quality - The quality value as a string. |
format | public static String format(List<? extends Preference<?>> prefs) throws IOException(Code) | | Formats a list of preferences with a comma separator.
Parameters: prefs - The list of preferences. The formatted list of preferences. throws: IOException - |
formatQuality | public static void formatQuality(float quality, Appendable destination) throws IOException(Code) | | Formats a quality value. If the quality is invalid, an
IllegalArgumentException is thrown.
Parameters: quality - The quality value as a float. Parameters: destination - The appendable destination; throws: IOException - |
isQuality | public static boolean isQuality(float quality)(Code) | | Indicates if the quality value is valid.
Parameters: quality - The quality value. True if the quality value is valid. |
parseCharacterSets | public static void parseCharacterSets(String acceptCharsetHeader, ClientInfo client)(Code) | | Parses character set preferences from a header.
Parameters: acceptCharsetHeader - The header to parse. Parameters: client - The client preferences to update. |
parseEncodings | public static void parseEncodings(String acceptEncodingHeader, ClientInfo preference)(Code) | | Parses encoding preferences from a header.
Parameters: acceptEncodingHeader - The header to parse. Parameters: preference - The client preferences to update. |
parseLanguages | public static void parseLanguages(String acceptLanguageHeader, ClientInfo preference)(Code) | | Parses language preferences from a header.
Parameters: acceptLanguageHeader - The header to parse. Parameters: preference - The client preferences to update. |
parseMediaTypes | public static void parseMediaTypes(String acceptMediaTypeHeader, ClientInfo preference)(Code) | | Parses media type preferences from a header.
Parameters: acceptMediaTypeHeader - The header to parse. Parameters: preference - The client preferences to update. |
parseQuality | public static float parseQuality(String quality)(Code) | | Parses a quality value. If the quality is invalid, an
IllegalArgumentException is thrown.
Parameters: quality - The quality value as a string. The parsed quality value as a float. |
|
|