Returns a decoder for the specified encoding. @param encoding normed encoding @return decoder @throws IOException I/O exception
(final String encoding)
| 47 | * @throws IOException I/O exception |
| 48 | */ |
| 49 | static TextDecoder get(final String encoding) throws IOException { |
| 50 | return switch(encoding) { |
| 51 | case UTF8 -> new UTF8(); |
| 52 | case UTF32 -> new UTF32(); |
| 53 | case UTF16LE -> new UTF16LE(); |
| 54 | case UTF16, UTF16BE -> new UTF16BE(); |
| 55 | default -> new Generic(encoding); |
| 56 | }; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Reads a UTF-16 codepoint. |