3 ms·
FWIW getBytes(Charset) doesn't throw, and there's a base set of charsets in StandardCharsets (1.7+): someString.getBytes(StandardCharsets.UTF_8); (Charset
by masklinn 11y ago
FWIW getBytes(Charset) doesn't throw, and there's a base set of charsets in StandardCharsets (1.7+):
someString.getBytes(StandardCharsets.UTF_8);
(Charset.forName doesn't throw either, StandardCharsets avoid stringly-typed code but it's not available on 1.6 so if you're still stuck there Charset.forName works)
- jdmichal 11y agoYou see the same thing with cipher suites, and there's unfortunately no `StandardCiphers` class.
- Aaargh20318 11y agoyeah I know, this was just the first example that came to mind.