I still want to know how to format a byte sequence where each byte has a prefix 
(or suffix).

Eg.

        { 0x00, 0x01, 0x02, 0xOD, 0x0E, 0x0F }

Douglas

> On Sep 2, 2020, at 2:26 PM, core-libs-dev-requ...@openjdk.java.net wrote:
> 
> Date: Wed, 2 Sep 2020 16:26:07 -0400
> From: Roger Riggs <roger.ri...@oracle.com <mailto:roger.ri...@oracle.com>>
> To: core-libs-dev <core-libs-dev@openjdk.java.net 
> <mailto:core-libs-dev@openjdk.java.net>>
> Subject: RFR 8251989: Hex formatting and parsing
> Message-ID: <180eca84-19fe-2dc4-9e57-1d05328e1...@oracle.com 
> <mailto:180eca84-19fe-2dc4-9e57-1d05328e1...@oracle.com>>
> Content-Type: text/plain; charset=utf-8; format=flowed
> 
> Please review the updated API in the Javadoc.
> http://cr.openjdk.java.net/~rriggs/hex-formatter/java.base/java/util/Hex.html 
> <http://cr.openjdk.java.net/~rriggs/hex-formatter/java.base/java/util/Hex.html>
> 
> A few offline contacts encouaged me to explore expanding the support
> for formatting and parsing of primitive types.
> Adding formatting toHex methods and [arsing fromHex methods makes the
> API easier to use.
> 
> For example, there are a number of protocols that need to escape char 
> values
> as hex. For symmetry across the primitive types, byte, char, short, int, 
> and long
> methods are added.
> 
> The handling of invalid digits was changed to consistently throw
> IllegalArgumentException; it is unlikely that encoding and decoding
> run into invalid characters and the previous technique requiring the caller
> to check the value for negative numbers is error prone.
> 
> There is some danger of proliferating methods yet, so not all combinations
> are included.? Feedback welcome.
> 
> With the API still shifting, the implemention is not ready to review.
> 
> Thanks, Roger
> 

Reply via email to