How about StringBuilder::appendHex instead of Encoder::encode(SB, byte[])? Then we don’t need to break the chain when appending many different things to a StringBuilder.
Also, are prefix and suffix really useful? One can easily add them. Thanks, Max > On Aug 19, 2020, at 5:14 PM, Roger Riggs <roger.ri...@oracle.com> wrote: > > Please review a java.util.Hex API to encode and decode hexadecimal strings to > and from byte arrays. > > Within the JDK and JDK tests there are multiple implementations to encode and > decode > hexadecimal strings to byte arrays. Hex encoders and decoders support > upper or lower case hexadecimal characters, delimiters, prefix, and suffix. > The API is modeled after the java.util.Base64 API providing static factories, > immutable threadsafe instances with methods to encode to and decode from > string and StringBuilder. > > JavaDoc: > http://cr.openjdk.java.net/~rriggs/hex-javadoc/java.base/java/util/Hex.html > > Webrev for Hex encoder and decoder: > http://cr.openjdk.java.net/~rriggs/webrev-hex-encoder-8251989 > > Webrev for applying to java.security: > http://cr.openjdk.java.net/~rriggs/webrev-hex-security-8252055 > > CSR: > https://bugs.openjdk.java.net/browse/JDK-8251991 > > Issue for API and a few uses: > https://bugs.openjdk.java.net/browse/JDK-8251989 > > Issue for Use in java.security and tests: > https://bugs.openjdk.java.net/browse/JDK-8252055 >