RFR: 8251989: Hex formatting and parsing utility [v7]

Marcono1234 github.com+11685886+marcono1234 at openjdk.java.net
Wed Oct 21 18:07:20 UTC 2020


On Wed, 21 Oct 2020 17:33:26 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> java.util.HexFormat utility:
>> 
>>  - Format and parse hexadecimal strings, with parameters for delimiter, prefix, suffix and upper/lowercase
>>  - Static factories and builder methods to create HexFormat copies with modified parameters.
>>  - Consistent naming of methods for conversion of byte arrays to formatted strings and back: formatHex and parseHex
>>  - Consistent naming of methods for conversion of primitive types: toHexDigits... and fromHexDigits...
>>  - Prefix and suffixes now apply to each formatted value, not the string as a whole
>>  - Using java.util.Appendable as a target for buffered conversions so output to Writers and PrintStreams
>>    like System.out are supported in addition to StringBuilder. (IOExceptions are converted to unchecked exceptions)
>>  - Immutable and thread safe, a "value-based" class
>> 
>> See the [HexFormat javadoc](http://cr.openjdk.java.net/~rriggs/8251989-hex-formatter/java.base/java/util/HexFormat.html) for details.
>> 
>> Review comments and suggestions welcome.
>
> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Review comment updates, in the example code, and to describe the characters used to convert to hexadecimal

src/java.base/share/classes/java/util/HexFormat.java line 62:

> 60:  * the {@code formatHex} methods include {@link #formatHex(byte[]) formatHex(byte[])}
> 61:  * and {@link #formatHex(Appendable, byte[]) formatHex(Appendable, byte[])}.
> 62:  * The formatted output is a string or to {@link Appendable} types including

Suggestion:

 * The formatted output is a string or can be appended to {@link Appendable} types including
It looks like "can be appended" got lost.

What about using "such as" instead of "including" to make it more clear that these are only example classes?

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

PR: https://git.openjdk.java.net/jdk/pull/482


More information about the core-libs-dev mailing list