Review request : 4884238 : Constants for standard charsets
mike.duigou at oracle.com
Mon Apr 11 21:31:15 UTC 2011
This webrev proposes a class java.nio.charset.Charsets to contain definitions for the (currently) six standard character sets and a seventh definition for the platform default character set. There are also minor amendments to the existing javadoc.
This change has been previously proposed but the constants were to be defined in Charset which was deemed to have too high a static initialization cost. Using a separate class, Charsets, means that the cost for initialization is only borne by those who use the class--there's virtually no incremental cost to platform initialization.
These standard charsets are primarily of value to those currently using the various I/O APIs which take a charset name as a string and throw UnsupportedEncodingException by allowing for easier usage of the APIs which take a Charset instead.
It's not been determined yet whether this change, even the change is well received, will make the cutoff for Java 7. It's coming in very late so it is possible that it may be held back until Java 8 for timing/testing/l18n/release issues.
More information about the core-libs-dev