com.ibm.wsspi.http

Interface EncodingUtils


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

Method Summary

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

Method Detail

getDefaultEncoding

  1. java.lang.String getDefaultEncoding( )
Query the default encoding.
Returns:
String

getCharsetFromContentType

  1. 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

  1. 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

  1. java.lang.String getEncodingFromLocale( java.util.Locale locale)
Get the encoding for a passed in locale.
Parameters:
locale -
Returns:
The encoding.

getJvmConverter

  1. 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

  1. 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

  1. 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)