public static UnicodeUtils getInstance(int charEncodingCode)
            throws UnicodeException
    {
        switch (charEncodingCode)
        {
        case CHAR_ENCODING_CODE_ISO_8859_1:
            return new UnicodeMetricsASCII();
        case CHAR_ENCODING_CODE_UTF_8:
            // Debug.debug("CHAR_ENCODING_CODE_UTF_8");
            return new UnicodeMetricsUTF8();
        case CHAR_ENCODING_CODE_UTF_16_BIG_ENDIAN_WITH_BOM:
        case CHAR_ENCODING_CODE_UTF_16_LITTLE_ENDIAN_WITH_BOM:
            // Debug.debug("CHAR_ENCODING_CODE_UTF_16_WITH_BOM");
            return new UnicodeMetricsUTF16WithBOM();
        case CHAR_ENCODING_CODE_UTF_16_BIG_ENDIAN_NO_BOM:
            return new UnicodeMetricsUTF16NoBOM(BYTE_ORDER_BIG_ENDIAN);
        case CHAR_ENCODING_CODE_UTF_16_LITTLE_ENDIAN_NO_BOM:
            return new UnicodeMetricsUTF16NoBOM(BYTE_ORDER_LITTLE_ENDIAN);
        default:
            throw new UnicodeException("Unknown char encoding code: "
                    + charEncodingCode);
        }
    }