com.ibm.wsspi.http
Interface EncodingUtils


public interface EncodingUtils

EncodingUtils provides various methods for manipulating and retrieving information related to charsets, locales, and other encoding data.


Method Summary
 java.lang.String getCharsetFromContentType(java.lang.String type)
          Basically returns everything after ";charset=".
 java.lang.String getDefaultEncoding()
          Query the default encoding.
 java.lang.String getEncodingFromLocale(java.util.Locale locale)
          Get the encoding for a passed in locale.
 java.lang.String getJvmConverter(java.lang.String encoding)
          Get the JVM Converter for the specified encoding.
 java.util.List<java.util.Locale> getLocales(java.lang.String acceptLangHdr)
          Returns a list of locales from the passed in Accept-Language header.
 boolean isCharsetSupported(java.lang.String charset)
          Tests whether the specified charset is supported on the server.
 java.lang.String stripQuotes(java.lang.String value)
          Utility method to trim off any leading or trailing quotes (single or double).
 

Method Detail

getDefaultEncoding

java.lang.String getDefaultEncoding()
Query the default encoding.

Returns:
String

getCharsetFromContentType

java.lang.String getCharsetFromContentType(java.lang.String type)
Basically returns everything after ";charset=". If no charset specified, return null.

Parameters:
type - to extract the charset from.
Returns:
The charset encoding.

getLocales

java.util.List<java.util.Locale> getLocales(java.lang.String acceptLangHdr)
Returns a list of locales from the passed in Accept-Language header.

Parameters:
acceptLangHdr -
Returns:
List

getEncodingFromLocale

java.lang.String getEncodingFromLocale(java.util.Locale locale)
Get the encoding for a passed in locale.

Parameters:
locale -
Returns:
The encoding.

getJvmConverter

java.lang.String getJvmConverter(java.lang.String encoding)
Get the JVM Converter for the specified encoding.

Parameters:
encoding -
Returns:
The converter if it exists, otherwise return the encoding.

isCharsetSupported

boolean isCharsetSupported(java.lang.String charset)
Tests whether the specified charset is supported on the server.

Parameters:
charset - we want to test
Returns:
boolean indicating if supported

stripQuotes

java.lang.String stripQuotes(java.lang.String value)
Utility method to trim off any leading or trailing quotes (single or double).

Parameters:
value -
Returns:
String (null if null input provided)