Returns the Java-level Charset based on given SQL-level name. @param charsetName Sql charset name, must not be null. @return charset, or default charset if charsetName is null. @throws UnsupportedCharsetException If no support for the named charset is available in this instance of the J
(String charsetName)
| 1044 | * is available in this instance of the Java virtual machine |
| 1045 | */ |
| 1046 | public static Charset getCharset(String charsetName) { |
| 1047 | String javaCharsetName = |
| 1048 | translateCharacterSetName( |
| 1049 | requireNonNull(charsetName, "charsetName") |
| 1050 | .toUpperCase(Locale.ROOT)); |
| 1051 | if (javaCharsetName == null) { |
| 1052 | throw new UnsupportedCharsetException(charsetName); |
| 1053 | } |
| 1054 | return Charset.forName(javaCharsetName); |
| 1055 | } |
| 1056 | |
| 1057 | /** |
| 1058 | * Validate if value can be decoded by given charset. |
no test coverage detected