com.mysql.cj

## Class MysqlCharset

- java.lang.Object
- - com.mysql.cj.MysqlCharset

    class MysqlCharset
    extends Object

### Field Summary

Fields
`List<String>` `aliases`
`String` `charsetName`
`List<String>` `javaEncodingsUc`
`int` `mblen`
`ServerVersion` `minimumVersion`
`int` `priority`

### Constructor Summary

Constructors
Constructor and Description
`MysqlCharset(String charsetName, int mblen, int priority, String[] javaEncodings)` Constructs MysqlCharset object
`MysqlCharset(String charsetName, int mblen, int priority, String[] javaEncodings, ServerVersion minimumVersion)`
`MysqlCharset(String charsetName, int mblen, int priority, String[] javaEncodings, String[] charsetAliases)`

### Method Summary

All Methods Instance Methods Concrete Methods
`private void` `addEncodingMapping(String encoding)`
`(package private) String` `getMatchingJavaEncoding(String javaEncoding)` If javaEncoding parameter value is one of available java encodings for this charset then returns javaEncoding value as is.
`(package private) boolean` `isOkayForVersion(ServerVersion version)`
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### charsetName

    public final String charsetName

#### mblen

    public final int mblen

#### priority

    public final int priority

#### javaEncodingsUc

    public final List<String> javaEncodingsUc

#### aliases

    public final List<String> aliases

#### minimumVersion

    public final ServerVersion minimumVersion

### Constructor Detail

#### MysqlCharset

    public MysqlCharset(String charsetName,
                        int mblen,
                        int priority,
                        String[] javaEncodings)

Constructs MysqlCharset object

Parameters:
  `charsetName` - MySQL charset name
  `mblen` - Max number of bytes per character
  `priority` - MysqlCharset with highest value of this param will be used for Java encoding --> Mysql charsets conversion.
  `javaEncodings` - List of Java encodings corresponding to this MySQL charset; the first name in list is the default for mysql --> java data conversion

#### MysqlCharset

    public MysqlCharset(String charsetName,
                        int mblen,
                        int priority,
                        String[] javaEncodings,
                        String[] charsetAliases)

#### MysqlCharset

    public MysqlCharset(String charsetName,
                        int mblen,
                        int priority,
                        String[] javaEncodings,
                        ServerVersion minimumVersion)

### Method Detail

#### addEncodingMapping

    private void addEncodingMapping(String encoding)

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### isOkayForVersion

    boolean isOkayForVersion(ServerVersion version)

#### getMatchingJavaEncoding

    String getMatchingJavaEncoding(String javaEncoding)

If javaEncoding parameter value is one of available java encodings for this charset then returns javaEncoding value as is. Otherwise returns first available java encoding name.

Parameters:
  `javaEncoding` - java encoding name
Returns:
  java encoding name

Copyright © 2016, 2024, Oracle and/or its affiliates.