程序包 com.mysql.cj
类 CharsetMapping
- java.lang.Object
-
- com.mysql.cj.CharsetMapping
-
- 直接已知子类:
NativeCharsetSettings
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 :(
-
-
字段概要
-
构造器概要
构造器 构造器 说明 CharsetMapping()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 protected static IntegergetStaticCollationIndexForCollationName(String collationName)protected static intgetStaticCollationIndexForJavaEncoding(String javaEncoding, ServerVersion version)protected static intgetStaticCollationIndexForMysqlCharsetName(String charsetName)static StringgetStaticCollationNameForCollationIndex(Integer collationIndex)static StringgetStaticJavaEncodingForCollationIndex(Integer collationIndex)protected static StringgetStaticJavaEncodingForCollationIndex(Integer collationIndex, String fallbackJavaEncoding)protected static StringgetStaticJavaEncodingForMysqlCharset(String mysqlCharsetName)protected static StringgetStaticJavaEncodingForMysqlCharset(String mysqlCharsetName, String fallbackJavaEncoding)MySQL charset could map to several Java encodings.protected static intgetStaticMblen(String charsetName)protected static List<String>getStaticMysqlCharsetAliasesByName(String mysqlCharsetName)protected static com.mysql.cj.MysqlCharsetgetStaticMysqlCharsetByName(String mysqlCharsetName)protected static StringgetStaticMysqlCharsetForJavaEncoding(String javaEncoding, ServerVersion version)static StringgetStaticMysqlCharsetNameForCollationIndex(Integer collationIndex)protected static booleanisStaticImpermissibleCollation(int collationIndex)protected static booleanisStaticMultibyteCharset(String javaEncodingName)Does the character set contain multi-byte encoded characters.
-
-
-
字段详细资料
-
MAP_SIZE
public static final int MAP_SIZE
- 另请参阅:
- 常量字段值
-
MYSQL_COLLATION_INDEX_utf8mb4_general_ci
public static final int MYSQL_COLLATION_INDEX_utf8mb4_general_ci
- 另请参阅:
- 常量字段值
-
MYSQL_COLLATION_INDEX_utf8mb4_0900_ai_ci
public static final int MYSQL_COLLATION_INDEX_utf8mb4_0900_ai_ci
- 另请参阅:
- 常量字段值
-
MYSQL_COLLATION_INDEX_binary
public static final int MYSQL_COLLATION_INDEX_binary
- 另请参阅:
- 常量字段值
-
-
方法详细资料
-
getStaticMysqlCharsetForJavaEncoding
protected static String getStaticMysqlCharsetForJavaEncoding(String javaEncoding, ServerVersion version)
-
getStaticCollationIndexForJavaEncoding
protected static int getStaticCollationIndexForJavaEncoding(String javaEncoding, ServerVersion version)
-
getStaticCollationIndexForMysqlCharsetName
protected static int getStaticCollationIndexForMysqlCharsetName(String charsetName)
-
getStaticMysqlCharsetNameForCollationIndex
public static String getStaticMysqlCharsetNameForCollationIndex(Integer collationIndex)
-
getStaticCollationNameForCollationIndex
public static String getStaticCollationNameForCollationIndex(Integer collationIndex)
-
getStaticCollationIndexForCollationName
protected static Integer getStaticCollationIndexForCollationName(String collationName)
-
getStaticJavaEncodingForMysqlCharset
protected static String getStaticJavaEncodingForMysqlCharset(String mysqlCharsetName, String fallbackJavaEncoding)
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 namefallbackJavaEncoding- fall-back java encoding name- 返回:
- java encoding name
-
getStaticMysqlCharsetByName
protected static com.mysql.cj.MysqlCharset getStaticMysqlCharsetByName(String mysqlCharsetName)
-
getStaticMysqlCharsetAliasesByName
protected static List<String> getStaticMysqlCharsetAliasesByName(String mysqlCharsetName)
-
getStaticJavaEncodingForMysqlCharset
protected static String getStaticJavaEncodingForMysqlCharset(String mysqlCharsetName)
-
getStaticJavaEncodingForCollationIndex
protected static String getStaticJavaEncodingForCollationIndex(Integer collationIndex, String fallbackJavaEncoding)
-
getStaticJavaEncodingForCollationIndex
public static String getStaticJavaEncodingForCollationIndex(Integer collationIndex)
-
isStaticMultibyteCharset
protected static boolean isStaticMultibyteCharset(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.
-
getStaticMblen
protected static int getStaticMblen(String charsetName)
-
isStaticImpermissibleCollation
protected static boolean isStaticImpermissibleCollation(int collationIndex)
-
-