-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
b23
In many places standard charsets are looked up via their names, for example:
"Mighty Aphrodite".getBytes("UTF8")
This could be done more efficiently with use of java.nio.charset.StandardCharsets:
"Mighty Aphrodite".getBytes(UTF_8)
The later variant also makes the code cleaner, as it is known not to throw UnsupportedEncodingException in contrary to the former variant.
"Mighty Aphrodite".getBytes("UTF8")
This could be done more efficiently with use of java.nio.charset.StandardCharsets:
"Mighty Aphrodite".getBytes(UTF_8)
The later variant also makes the code cleaner, as it is known not to throw UnsupportedEncodingException in contrary to the former variant.
- relates to
-
JDK-8234147 Avoid looking up standard charsets in core libraries
-
- Resolved
-