<i18n dev> RFR: 8372353: API to compute the byte length of a String encoded in a given Charset [v17]

Chen Liang liach at openjdk.org
Wed Feb 25 16:59:36 UTC 2026


On Wed, 25 Feb 2026 16:39:45 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Liam Miller-Cushon has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Rename getBytesLength to getByteLength
>
> src/java.base/share/classes/java/lang/String.java line 2119:
> 
>> 2117:      * @since 27
>> 2118:      */
>> 2119:     public int getByteLength(Charset cs) {
> 
> `getEncodedLength(Charset cs)` is a stronger name, more evocative of the value being computed.
> The name should not rely on the argument to hint at its primary function.

Or `encodedLength` to be consistent with the other queries.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28454#discussion_r2854220759


More information about the i18n-dev mailing list