程序包 com.mysql.cj
类 CharsetMapping
- java.lang.Object
-
- com.mysql.cj.CharsetMapping
-
public class CharsetMapping extends Object
Mapping between MySQL charset names and Java charset names. I've investigated placing these in a .properties file, but unfortunately under most appservers this complicates configuration because the security policy needs to be changed by the user to allow the driver to read them :(
-
-
字段概要
字段 修饰符和类型 字段 说明 static Map<String,com.mysql.cj.MysqlCharset>CHARSET_NAME_TO_CHARSETstatic Map<String,Integer>CHARSET_NAME_TO_COLLATION_INDEXstatic com.mysql.cj.MysqlCharset[]COLLATION_INDEX_TO_CHARSETstatic String[]COLLATION_INDEX_TO_COLLATION_NAMEstatic StringCOLLATION_NOT_DEFINEDstatic intMAP_SIZEstatic intMYSQL_COLLATION_INDEX_binarystatic intMYSQL_COLLATION_INDEX_utf8static StringNOT_USEDstatic Set<Integer>UTF8MB4_INDEXES
-
构造器概要
构造器 构造器 说明 CharsetMapping()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static intgetCollationIndexForJavaEncoding(String javaEncoding, ServerVersion version)static StringgetJavaEncodingForCollationIndex(Integer collationIndex)static StringgetJavaEncodingForCollationIndex(Integer collationIndex, String javaEncoding)static StringgetJavaEncodingForMysqlCharset(String mysqlCharsetName)static StringgetJavaEncodingForMysqlCharset(String mysqlCharsetName, String javaEncoding)MySQL charset could map to several Java encodings.static intgetMblen(String charsetName)static StringgetMysqlCharsetForJavaEncoding(String javaEncoding, ServerVersion version)static StringgetMysqlCharsetNameForCollationIndex(Integer collationIndex)static intgetNumberOfCharsetsConfigured()static booleanisMultibyteCharset(String javaEncodingName)Does the character set contain multi-byte encoded characters.
-
-
-
字段详细资料
-
MAP_SIZE
public static final int MAP_SIZE
- 另请参阅:
- 常量字段值
-
COLLATION_INDEX_TO_COLLATION_NAME
public static final String[] COLLATION_INDEX_TO_COLLATION_NAME
-
COLLATION_INDEX_TO_CHARSET
public static final com.mysql.cj.MysqlCharset[] COLLATION_INDEX_TO_CHARSET
-
CHARSET_NAME_TO_CHARSET
public static final Map<String,com.mysql.cj.MysqlCharset> CHARSET_NAME_TO_CHARSET
-
CHARSET_NAME_TO_COLLATION_INDEX
public static final Map<String,Integer> CHARSET_NAME_TO_COLLATION_INDEX
-
MYSQL_COLLATION_INDEX_utf8
public static final int MYSQL_COLLATION_INDEX_utf8
- 另请参阅:
- 常量字段值
-
MYSQL_COLLATION_INDEX_binary
public static final int MYSQL_COLLATION_INDEX_binary
- 另请参阅:
- 常量字段值
-
-
方法详细资料
-
getMysqlCharsetForJavaEncoding
public static final String getMysqlCharsetForJavaEncoding(String javaEncoding, ServerVersion version)
-
getCollationIndexForJavaEncoding
public static int getCollationIndexForJavaEncoding(String javaEncoding, ServerVersion version)
-
getMysqlCharsetNameForCollationIndex
public static String getMysqlCharsetNameForCollationIndex(Integer collationIndex)
-
getJavaEncodingForMysqlCharset
public static String getJavaEncodingForMysqlCharset(String mysqlCharsetName, String javaEncoding)
MySQL charset could map to several Java encodings. So here we choose the one according to next rules:- if there is no static mapping for this charset then return javaEncoding value as is because this could be a custom charset for example
- if static mapping exists and javaEncoding equals to one of Java encoding canonical names or aliases available for this mapping then javaEncoding value as is; this is required when result should match to connection encoding, for example if connection encoding is Cp943 we must avoid getting SHIFT_JIS for sjis mysql charset
- if static mapping exists and javaEncoding doesn't match any Java encoding canonical names or aliases available for this mapping then return default Java encoding (the first in mapping list)
- 参数:
mysqlCharsetName- MySQL charset namejavaEncoding- fall-back java encoding name- 返回:
- java encoding name
-
getJavaEncodingForMysqlCharset
public static String getJavaEncodingForMysqlCharset(String mysqlCharsetName)
-
getJavaEncodingForCollationIndex
public static String getJavaEncodingForCollationIndex(Integer collationIndex, String javaEncoding)
-
getJavaEncodingForCollationIndex
public static String getJavaEncodingForCollationIndex(Integer collationIndex)
-
getNumberOfCharsetsConfigured
public static final int getNumberOfCharsetsConfigured()
-
isMultibyteCharset
public static final boolean isMultibyteCharset(String javaEncodingName)
Does the character set contain multi-byte encoded characters.- 参数:
javaEncodingName- java encoding name- 返回:
- true if the character set contains multi-byte encoded characters.
-
getMblen
public static int getMblen(String charsetName)
-
-