FileDocCategorySizeDatePackage
CharacterSets.javaAPI DocAndroid 1.5 API5931Wed May 06 22:41:56 BST 2009com.google.android.mms.pdu

CharacterSets

public class CharacterSets extends Object

Fields Summary
public static final int
ANY_CHARSET
IANA assigned MIB enum numbers. From wap-230-wsp-20010705-a.pdf Any-charset = Equivalent to the special RFC2616 charset value "*"
public static final int
US_ASCII
public static final int
ISO_8859_1
public static final int
ISO_8859_2
public static final int
ISO_8859_3
public static final int
ISO_8859_4
public static final int
ISO_8859_5
public static final int
ISO_8859_6
public static final int
ISO_8859_7
public static final int
ISO_8859_8
public static final int
ISO_8859_9
public static final int
SHIFT_JIS
public static final int
UTF_8
public static final int
BIG5
public static final int
UCS2
public static final int
UTF_16
public static final int
DEFAULT_CHARSET
If the encoding of given data is unsupported, use UTF_8 to decode it.
private static final int[]
MIBENUM_NUMBERS
Array of MIB enum numbers.
public static final String
MIMENAME_ANY_CHARSET
The Well-known-charset Mime name.
public static final String
MIMENAME_US_ASCII
public static final String
MIMENAME_ISO_8859_1
public static final String
MIMENAME_ISO_8859_2
public static final String
MIMENAME_ISO_8859_3
public static final String
MIMENAME_ISO_8859_4
public static final String
MIMENAME_ISO_8859_5
public static final String
MIMENAME_ISO_8859_6
public static final String
MIMENAME_ISO_8859_7
public static final String
MIMENAME_ISO_8859_8
public static final String
MIMENAME_ISO_8859_9
public static final String
MIMENAME_SHIFT_JIS
public static final String
MIMENAME_UTF_8
public static final String
MIMENAME_BIG5
public static final String
MIMENAME_UCS2
public static final String
MIMENAME_UTF_16
public static final String
DEFAULT_CHARSET_NAME
private static final String[]
MIME_NAMES
Array of the names of character sets.
private static final HashMap
MIBENUM_TO_NAME_MAP
private static final HashMap
NAME_TO_MIBENUM_MAP
Constructors Summary
private CharacterSets()


     
        // Create the HashMaps.
        MIBENUM_TO_NAME_MAP = new HashMap<Integer, String>();
        NAME_TO_MIBENUM_MAP = new HashMap<String, Integer>();
        assert(MIBENUM_NUMBERS.length == MIME_NAMES.length);
        int count = MIBENUM_NUMBERS.length - 1;
        for(int i = 0; i <= count; i++) {
            MIBENUM_TO_NAME_MAP.put(MIBENUM_NUMBERS[i], MIME_NAMES[i]);
            NAME_TO_MIBENUM_MAP.put(MIME_NAMES[i], MIBENUM_NUMBERS[i]);
        }
    
Methods Summary
public static intgetMibEnumValue(java.lang.String mimeName)
Map a well-known charset name to its assigned MIBEnum number.

param
mimeName The charset name.
return
The MIBEnum number assigned by IANA for this charset.
throws
UnsupportedEncodingException

        if(null == mimeName) {
            return -1;
        }

        Integer mibEnumValue = NAME_TO_MIBENUM_MAP.get(mimeName);
        if (mibEnumValue == null) {
            throw new UnsupportedEncodingException();
        }
        return mibEnumValue;
    
public static java.lang.StringgetMimeName(int mibEnumValue)
Map an MIBEnum number to the name of the charset which this number is assigned to by IANA.

param
mibEnumValue An IANA assigned MIBEnum number.
return
The name string of the charset.
throws
UnsupportedEncodingException

        String name = MIBENUM_TO_NAME_MAP.get(mibEnumValue);
        if (name == null) {
            throw new UnsupportedEncodingException();
        }
        return name;